Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

174

Downloads of v 2506.9.21:

7

Last Update:

16 Jun 2025

Published Date:

16 Jun 2025

Package Maintainer(s):

Software Author(s):

  • JJ Fullmer
  • FOG Project

Tags:

psmodule fog fogapi imaging provisioning fogproject

FogApi Powershell Module

(Ready for review)

  • 1
  • 2
  • 3

2506.9.21 | Updated: 16 Jun 2025

Downloads:

174

Downloads of v 2506.9.21:

7

Published:

16 Jun 2025

Maintainer(s):

Software Author(s):

  • JJ Fullmer
  • FOG Project

FogApi Powershell Module 2506.9.21

(Ready for review)

Legal Disclaimer: Neither this package nor Chocolatey Software, Inc. are affiliated with or endorsed by JJ Fullmer, FOG Project. The inclusion of JJ Fullmer, FOG Project trademark(s), if any, upon this webpage is solely to identify JJ Fullmer, FOG Project goods or services and not for commercial purposes.

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
IMPORTANT

This version is in moderation and has not yet been approved. This means it doesn't show up under normal search.

  • Until approved, you should consider this package version unsafe - it could do very bad things to your system (it probably doesn't but you have been warned, that's why we have moderation).
  • This package version can change wildly over the course of moderation until it is approved. If you install it and it later has changes to this version, you will be out of sync with any changes that have been made to the package. Until approved, you should consider that this package version doesn't even exist.
  • You cannot install this package under normal scenarios. See How to install package version under moderation for more information.
  • There are also no guarantees that it will be approved.
WARNING

There are versions of this package awaiting moderation (possibly just this one). See the Version History section below.

DarkSideMilk (maintainer) on 16 Jun 2025 20:04:09 +00:00:

User 'DarkSideMilk' (maintainer) submitted package.

chocolatey-ops (reviewer) on 16 Jun 2025 20:39:49 +00:00:

FogApi has passed automated validation. It may have or may still fail other checks like testing (verification).
NOTE: No required changes that the validator checks have been flagged! It is appreciated if you fix other items, but only Requirements will hold up a package version from approval. A human review could still turn up issues a computer may not easily find.

Guidelines

Guidelines are strong suggestions that improve the quality of a package version. These are considered something to fix for next time to increase the quality of the package. Over time Guidelines can become Requirements. A package version can be approved without addressing Guideline comments but will reduce the quality of the package.

  • Chocolatey Packages are meant to be thin wrappers on top of the native installation packages, as a result, there is an expectation that the installation scripts will be less than 100 lines. Can the automation scripts be simplified? More...

chocolatey-ops (reviewer) on 16 Jun 2025 20:54:45 +00:00:

FogApi has passed automated package testing (verification). The next step in the process is package scanning.
Please visit https://gist.github.com/choco-bot/70f8f9ce15b37b27dcf1c520e259caa8 for details.
This is an FYI only. There is no action you need to take.

chocolatey-ops (reviewer) on 16 Jun 2025 22:15:23 +00:00:

FogApi has passed automated virus scanning.

Description

FogApi Powershell Module Chocolatey Package

Requires Powershell 5.1+ (Core 7+ recommended).

This package installs the FogApi module in the AllUsers/System scope for:

  • Powershell 7+ (C:\Program Files\Powershell\Modules\FogApi{version})
  • Powershell 5.1 (C:\Program Files\WindowsPowershell\Modules\FogApi{version})

This ensures compatibility across pwsh versions (which are both included in Win11).
During default install, any other existing module versions are removed from both pwsh versions to avoid version conflicts.
The default uninstall behavior removes the specific module version of the given Chocolatey package.
You can customize this behavior with package parameters, though defaults are recommended.

Package Parameters

You can set the following parameters to alter the install behavior:

  • /PS7Only: (true/false) - Install/uninstall only for Powershell 7. Defaults to false. Overwrites PS5Only if BOTH are true
  • /PS5Only: (true/false) - Install/uninstall only for Powershell 5. Defaults to false.
  • /NoRemove: (true/false) - (Install only) Do not remove other versions. Defaults to false.
  • /RemoveAll: (true/false) - (Uninstall only) Uninstall all versions. Defaults to false.

Examples:

Install for Pwsh 7 only without removing other versions: choco install fogapi --params "'/PS7Only:true /NoRemove:true'"
Uninstall all versions: choco uninstall fogapi --params "'/RemoveAll'"

FOG Api Powershell Module

This is a powershell module to simplify the use of the Fog Project API.
This module is used to easily run Fog API commands on your fogserver from a powershell console or script.
FOG is an opensource tool for imaging comptuters, this module uses the API on your internal fog server to
perform almost any operation you can do in the GUI of Fog and provides you with the ability to extend things further.
It can be used to create more automation or to simply have a command line method of controlling fog operations.
This essentially gives you a crossplatform commandline interface for fog tasks and makes many things easier to automate.

Docs for this module can be found at https://fogapi.readthedocs.io/en/latest/

For more information about FOG see

Versioning

The versioning of this module follows this pattern

{Year|Month}.{Major Version}.{Revision #}

See https://github.com/darksidemilk/FogApi?tab=readme-ov-file#versioning for more info

Usage

You can use Set-fogserverSettings to set your fogserver hostname and api keys.
Or, the first time you try to run a command the settings.json file will automatically open in an OS Specific editor.
You can also open the settings.json file and edit it manually before running your first command.
The default settings are explanations of where to find the proper settings since json cannot have comments

Once the settings are set you can utilze the fog documentation found here https://news.fogproject.org/simplified-api-documentation/ that was used to model the parameters for Get-FogObject, Update-FogObject, and Remove-FogObject.
You can also utilize simpler functions of common tasks, see the links below for more info.

Additional info


tools\chocolateyInstall.ps1
$ErrorActionPreference = 'Stop'

$toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition
#include the additional functions for install
Import-Module "$toolsDir\functions.psm1"

$moduleName = $env:chocolateyPackageName 
$moduleVersion = $env:ChocolateyPackageVersion

$packageargs = @{
    packagename = $env:chocolateyPackageName
    destination = $null; #is set conditionally during a loop to install in multiple or chosen powershell paths
    Url = "https://github.com/darksidemilk/fogapi/releases/download/2506.9.21/fogapi.2506.9.21.IncludeXml.zip"
    Checksum = '1983A9A2F2217D5D34FF9EABE1A50B37155176B2F0E84DCB450ED58B48734706'
    ChecksumType = 'sha256'
}

$pp = Get-PackageParameters;

if (!($pp.PS7Only)) {
    $pp.PS7Only = $false;
} else {
    $pp.PS7Only = $true;
}
if (!($pp.PS5Only)) {
    $pp.PS5Only = $false;
} else {
    $pp.PS5Only = $true;
}
if (!($pp.NoRemove)) {
    $pp.NoRemove = $false;
} else {
    $pp.NoRemove = $true;
}
if ($pp.RemoveAll) {
    Write-Warning "'RemoveAll' was passed into install, this parameter is only for uninstall, this will be ignored"
    $pp.RemoveAll = $false;
} else {
    $pp.RemoveAll = $false;
}

# module may already be installed outside of Chocolatey, if so get it out of the current session
Remove-Module -Name $moduleName -Force -ErrorAction SilentlyContinue

#get the destination paths to install too

$destinationRootPath = New-Object -TypeName 'System.Collections.generic.list[System.Object]';
$ps7Pth = (Join-Path -Path $env:ProgramFiles -ChildPath "PowerShell\Modules\$moduleName")
$ps5Pth = (Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName")

if($pp.PS7Only) {
    if (Test-Path ($ps7Pth | Split-Path)) { #check if parent path exists
        $destinationRootPath.add($ps7Pth)
    } else {
        Write-Error "Powershell core module path doesn't exist but PS7Only was specified! install powershell-core package to install!"
        Set-PowershellExitCode -exitcode 1
        exit 1;
    }
    "Installing $modulename version $moduleVersion in pwsh 7+ system path only" | out-host;
} elseif ($pp.PS5Only) {
    if (Test-Path ($ps5Pth | Split-Path)) { #check if parent path exists
        $destinationRootPath.add($ps5Pth)
    } else {
        Write-Error "Powershell 5.1 module path doesn't exist and ps5only was specified, install powershell package to install"
        Set-PowershellExitCode -exitcode 1
        exit 1;
    }
    "Installing $modulename version $moduleVersion in windows powershell 5.1 system path only" | out-host;
} else {
    #add ps5 path
    if (Test-Path ($ps5Pth | Split-Path)) { #make sure parent path exists before adding it as a destination
        $destinationRootPath.add($ps5Pth)
    } else {
        Write-Warning "Powershell 5.1 module path doesn't exist, install powershell package for best experience"
    }
    #add ps7 path if exists
    if (Test-Path ($ps7Pth | Split-Path)) { #make sure parent path exists before adding it as a destination
        $destinationRootPath.add($ps7Pth)
    } else {
        Write-Warning "Powershell core path doesn't exist, install powershell-core package for best experience"
    }
    "Installing $modulename version $moduleVersion in both pwsh 7+ and windows powershell 5.1 system paths" | out-host;
}

if ($destinationRootPath.count -eq 0) {
    Write-Error "Neither powershell module path exists! Install powershell and or powershell-core and try again"
    Set-PowershellExitCode -exitcode 1
    exit 1
}

ForEach ($dest in $destinationRootPath) {
    $destPath = "$dest\$moduleVersion"
    Write-Verbose "Installing '$modulename' of version '$moduleVersion' to '$destPath'."
    # check destination path exists if force, remove it, otherwise don't overwrite existing path
    if (!(Test-Path -Path $destPath) -OR ($env:chocolateyForce)) {
        if ((Test-Path -Path $destPath) -and ($env:chocolateyForce)) {
            Write-Verbose "Force is specified, removing existing version at $destpath"
            if ($destPath -match "WindowsPowershell") {
                Remove-ModuleManually -modulename $modulename -moduleversion $moduleVersion -ps5only
            } else {
                Remove-ModuleManually -modulename $modulename -moduleversion $moduleVersion -ps7only
            }
        }
        $packageargs.destination = $destPath;
        #unzip module to current install path
        Install-ChocolateyZipPackage @packageargs;
        #set the install location for this install path on the PSGetModuleInfo.xml
        $psmodinfoxml = Import-Clixml "$destpath\PSGetModuleInfo.xml";
        $psmodinfoxml.InstalledLocation = $destpath;
        $psmodinfoxml | Export-Clixml -Path "$destPath\PSGetModuleInfo.xml" -Force;
        #set the PSGetModuleInfo.xml to be hidden to follow the same flow as an install from psresourceget or powershellget
        (get-item "$destPath\PSGetModuleInfo.xml").Attributes = "Hidden";
    } else {
        Write-Verbose "Path $destPath already exists! Not overwriting existing install of same version"
    }
}

#uninstall other versions after adding the new one

if (($pp.NoRemove)) {
    "'NoRemove' was specified, not removing any other installed versions of $modulename" | out-host;
} else {
    Write-Verbose "Finding and uninstalling/removing any other versions (older or newer) of $modulename"
    "Finding and removing any other versions of $modulename so only the latest is available at system level" | out-host;
    
    ForEach ($destPath in $destinationRootPath) {
        if (Test-path $destPath) {
            Write-Verbose "Uninstalling any other versions installed at $destPath"
            Write-verbose "removing system wide versions of module, remove module version folders that aren't the current version"
            $oldVersions = (Get-ChildItem $destPath -Directory -ea 0 -Exclude $moduleVersion);
            if ($null -ne $oldVersions) {
                $oldVersions | ForEach-Object {
                    $oldVersion = $_.fullname | Split-Path -leaf;
                    Remove-ModuleManually -modulename $moduleName -moduleVersion $oldVersion -ps5only:$pp.PS5Only -ps7only:$pp.PS7Only;
                }
            }
        }
    }
}

Write-host -ForegroundColor Green -Object @"
-----------------------------------------------------------------------------
FogApi Module version $moduleVersion is installed!
It was deployed to:

$($destinationRootPath | ForEach-Object {"`t- $($_)\$moduleVersion`n"})
- Import the module with 'Import-Module FogApi'
- List commands with 'Get-Command -module FogApi'
- Use 'Set-FogServerSettings -interactive' to configure your api connection 
- Use 'Get-Help Function-name' to get inline help, append '-online' to open the web version
- Use 'Get-Help about_fogapi' for an overview of the module
-----------------------------------------------------------------------------
"@
Set-PowershellExitCode -exitcode 0
tools\chocolateyUninstall.ps1
$ErrorActionPreference = 'Stop'

#uninstall just this version of the module from system level paths

$toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition
#include the additional functions for install
Import-Module "$toolsDir\functions.psm1"

$moduleName = $env:chocolateyPackageName 
$moduleVersion = $env:ChocolateyPackageVersion

$pp = Get-PackageParameters;

if (!($pp.PS7Only)) {
    $pp.PS7Only = $false;
} else {
    $pp.PS7Only = $true;
}
if (!($pp.PS5Only)) {
    $pp.PS5Only = $false;
} else {
    $pp.PS5Only = $true;
}
if (($pp.NoRemove)) {
    Write-Warning "'NoRemove' was passed into uninstall, this parameter is only for install, this will be ignored"
    $pp.NoRemove = $false;
} else {
    $pp.NoRemove = $false;
}
if (!($pp.RemoveAll)) {
    $pp.RemoveAll = $false;
} else {
    $pp.RemoveAll = $true;
}

Remove-Module -Name $moduleName -force -ea 0;
if ($pp.RemoveAll) {
    "Remove all specified, finding all versions of $modulename and removing them, is PS7Only or PS5Only is specified then only all versions from that path will be removed" | out-host;
    Remove-ModuleManually -modulename $moduleName -ps5only:$pp.PS5Only -ps7only:$pp.PS7Only -allversions;
} else {
    "Uninstalling module $modulename of version $moduleVersion" | out-host;
    Remove-ModuleManually -modulename $moduleName -moduleversion $moduleVersion -ps5only:$pp.PS5Only -ps7only:$pp.PS7Only;
}
tools\functions.psm1
function Grant-FullRightsToPath {
  <#
  .SYNOPSIS
  Use icacls to grant full rights to a user or users of a given path or paths
  
  .DESCRIPTION
  Loops through given paths and users and grants full access to the given paths for the given users
  uses icacls $path /grant username:F /T /C for explicit permissions, or uses inhertiable permissions on parent with -inherit
  You should send all paths without trailing slashes, but if you forget, the trailing slash will be removed for you.
  Unless you specify the -wait switch, the icacls processes will all start in the background. If you specify -wait each process will wait before the next is started
  The -wait or -waitoutput switch will display a string of all the output at the end of the function, a list object of the generated logs with the results is always returned.
  The result logs are stored in C:\logs\perms and have a syntax of the path(with - instead of \)_userOrGroup.log
  i.e. if one of your paths
  
  .PARAMETER path
  The path, or list of paths, to set permissions on
  
  .PARAMETER user
  The user/group or list of users/groups to give full permission to the given paths
  Defaults to Authenticated Users group. If it is a domain user or group, it needs "DOMAIN\common name" syntax
  Usernames and groups can have spaces if they are enclosed in ""

  .PARAMETER inherit
  Switch param to enable inheritance, when specified it will only enable the inheritable permissions on the parent folder
  If not specified, it will set the permissions explicitly on each file.
  IF you also enabled -recurseInherit then the recurse behavior overrides the only setting on the parent folder behavior
  
  .PARAMETER recurseInherit
  Switch param to enable inheritance, when specified it will enable inheritable permissions on the parent folder and all subfolders and files.
  This is typically not neccesarry over normal inherit but is provided as an option for flexibility
  This switch can be enabled with or without the -inherit switch

  .PARAMETER wait
  switch to enable waiting for each icacls process to finish before starting the next. When this is enabled, a string output of the logs will be displayed at the end

  .PARAMETER waitOutput
  Switch to enable a wait at the end of the function for all running icacls to finish, and then generate and display a string output

  .EXAMPLE
  Grant-FullRightsToPath -path "C:\Program Files\WindowsPowershell\Modules\FogApi","C:\Program Files\Powershell\Modules\FogApi" -user "Authenticated Users"

  This will give the authenticated users group full access to the install folder of the FogAPI module
  This helps during install/uninstall/update of the module. The settings.json file that contains the api key is stored elsewhere per user
  
  .NOTES
  This is a simple wrapper for a common use of icacls. This is the help info for icacls:    
  ICACLS name /save aclfile [/T] [/C] [/L] [/Q]
      stores the DACLs for the files and folders that match the name
      into aclfile for later use with /restore. Note that SACLs,
      owner, or integrity labels are not saved.

  ICACLS directory [/substitute SidOld SidNew [...]] /restore aclfile
                  [/C] [/L] [/Q]
      applies the stored DACLs to files in directory.

  ICACLS name /setowner user [/T] [/C] [/L] [/Q]
      changes the owner of all matching names. This option does not
      force a change of ownership; use the takeown.exe utility for
      that purpose.

  ICACLS name /findsid Sid [/T] [/C] [/L] [/Q]
      finds all matching names that contain an ACL
      explicitly mentioning Sid.

  ICACLS name /verify [/T] [/C] [/L] [/Q]
      finds all files whose ACL is not in canonical form or whose
      lengths are inconsistent with ACE counts.

  ICACLS name /reset [/T] [/C] [/L] [/Q]
      replaces ACLs with default inherited ACLs for all matching files.

  ICACLS name [/grant[:r] Sid:perm[...]]
        [/deny Sid:perm [...]]
        [/remove[:g|:d]] Sid[...]] [/T] [/C] [/L] [/Q]
        [/setintegritylevel Level:policy[...]]

      /grant[:r] Sid:perm grants the specified user access rights. With :r,
          the permissions replace any previously granted explicit permissions.
          Without :r, the permissions are added to any previously granted
          explicit permissions.

      /deny Sid:perm explicitly denies the specified user access rights.
          An explicit deny ACE is added for the stated permissions and
          the same permissions in any explicit grant are removed.

      /remove[:[g|d]] Sid removes all occurrences of Sid in the ACL. With
          :g, it removes all occurrences of granted rights to that Sid. With
          :d, it removes all occurrences of denied rights to that Sid.

      /setintegritylevel [(CI)(OI)]Level explicitly adds an integrity
          ACE to all matching files.  The level is to be specified as one
          of:
              L[ow]
              M[edium]
              H[igh]
          Inheritance options for the integrity ACE may precede the level
          and are applied only to directories.

      /inheritance:e|d|r
          e - enables inheritance
          d - disables inheritance and copy the ACEs
          r - remove all inherited ACEs


  Note:
      Sids may be in either numerical or friendly name form. If a numerical
      form is given, affix a * to the start of the SID.

      /T indicates that this operation is performed on all matching
          files/directories below the directories specified in the name.

      /C indicates that this operation will continue on all file errors.
          Error messages will still be displayed.

      /L indicates that this operation is performed on a symbolic link
        itself versus its target.

      /Q indicates that icacls should suppress success messages.

      ICACLS preserves the canonical ordering of ACE entries:
              Explicit denials
              Explicit grants
              Inherited denials
              Inherited grants

      perm is a permission mask and can be specified in one of two forms:
          a sequence of simple rights:
                  N - no access
                  F - full access
                  M - modify access
                  RX - read and execute access
                  R - read-only access
                  W - write-only access
                  D - delete access
          a comma-separated list in parentheses of specific rights:
                  DE - delete
                  RC - read control
                  WDAC - write DAC
                  WO - write owner
                  S - synchronize
                  AS - access system security
                  MA - maximum allowed
                  GR - generic read
                  GW - generic write
                  GE - generic execute
                  GA - generic all
                  RD - read data/list directory
                  WD - write data/add file
                  AD - append data/add subdirectory
                  REA - read extended attributes
                  WEA - write extended attributes
                  X - execute/traverse
                  DC - delete child
                  RA - read attributes
                  WA - write attributes
          inheritance rights may precede either form and are applied
          only to directories:
                  (OI) - object inherit
                  (CI) - container inherit
                  (IO) - inherit only
                  (NP) - don't propagate inherit
                  (I) - permission inherited from parent container

  Examples:

          icacls c:\windows\* /save AclFile /T
          - Will save the ACLs for all files under c:\windows
            and its subdirectories to AclFile.

          icacls c:\windows\ /restore AclFile
          - Will restore the Acls for every file within
            AclFile that exists in c:\windows and its subdirectories.

          icacls file /grant Administrator:(D,WDAC)
          - Will grant the user Administrator Delete and Write DAC
            permissions to file.

          icacls file /grant *S-1-1-0:(D,WDAC)
          - Will grant the user defined by sid S-1-1-0 Delete and
            Write DAC permissions to file.

  #>
  [CmdletBinding()]
  param (
      [string[]]$path,
      [string[]]$user = (@("Authenticated Users")),
      [switch]$inherit,
      [switch]$wait,
      [switch]$waitOutput,
      [switch]$recurseInherit,
      [switch]$noOutHost
  )
  
  
  process {
    $output = "";
    $prcs = New-List;
    $logs = New-List;
    if (!$noOutHost) {
      "Setting full access permissions for given paths to given users...." | Out-Host;
    } 
    Write-Verbose "Setting full access permissions for given paths:`n$($path)`nto given users`n$($user)`n...."
    $path | ForEach-Object {
        $pth = "$($_)"
        $logBase = "C:\logs\perms"
        New-Dir $logBase | Out-Null;
        if ($pth[-1] -eq '\') {
            if (!$noOutHost) {
              "Removing trailing slash from $pth for parsing" | Out-Host;
            }
            $pth = $pth.TrimEnd("\");
        }
        if (Test-Path $pth) {
          $itm = $pth.replace(":","-").replace("\","-");
          $user | ForEach-Object {
            $curUsr = $_;
            $log = "$logBase\$itm`_$($curUsr.replace("\","-")).log";
            New-Item -ItemType File -path $log -force -ea 0;
            $logs.add($log);
            if ($inherit -or $recurseInherit) {
              if ($recurseInherit) {
                $argStr = "`"$pth`" /inheritance:e /grant `"$curUsr`:(OI)(CI)(F)`" /T /C /Q"
              } else {
                $argStr = "`"$pth`" /inheritance:e /grant `"$curUsr`:(OI)(CI)(F)`" /C /Q"
              }
              Write-Verbose "Setting inheritable permissions on $pth for user/group $curUsr`:`n"
            } else {
              $argStr = "`"$pth`" /grant `"$curUsr`:(F)`" /T /C /Q"
              Write-Verbose "Setting explicit permissions on all files in $pth for user/group $curUsr`:`n"
            }
            # "Setting permissions on $pth for user $curUsr" | Out-Host;
            $prc = start-process -FilePath icacls.exe -args $argStr -NoNewWindow -RedirectStandardOutput $log -PassThru -wait:$wait.IsPresent -ea 0;
            $prcs.add($prc)
            Write-Verbose "$($prc | out-string) for $log is started";
            try {
              if ((get-content $log -raw) -match "No mapping between account names and security IDs was done") {
                throw "user $curUsr is invalid!"
                return $error[0];
              }
            } catch {
              Write-Verbose "not able to test for user validation"
            }
            
          }
        } else {
          throw "path $pth does not exist!"
          return $error[0];
        }
      }
    if (!$wait -AND $waitOutput) {
      if (!$noOutHost) {
        "waiting on icacls processes to finish...." | Out-Host;
      }
      $prcs | ForEach-Object {
        if ($_.hasexited) {
          Write-Verbose "process is already ended"
        } else {
          try {
            while (!$_.hasexited) {
              start-sleep -milliseconds 10
            }
          } catch {
            Write-Verbose "process is already ended"
          }
        }
      }
    }
    if ($waitOutput -or $wait) {
      if (!$noOutHost) {
        $output = "`nResults of icacls from logs:`n`n"
        $logs | ForEach-Object {
          # $output += "`n______________________________`n"
          $output += $_;
          $output += "`n______________________________`n`n"
          $output += Get-Content $_ -raw;
          $output += "`n------------------------------`n`n`n"
        }
        $output | Out-Host;
      }
    }
    return $logs;
  }
  
}

function Remove-ModuleManually {
  [CmdletBinding()]
  param (
    $modulename,
    $moduleversion,
    [switch]$ps5only,
    [switch]$ps7only,
    [switch]$allversions
  )
  process {
    $destinationPath = @()
    if ($allversions) {
      #if removing all versions, just remove the top level path, get the top level path per the be
      $moduleversion = $null;
    } else {
      Write-Verbose "Removing version $moduleVersion of $moduleName"
    }
    if($ps7only) {
      $destinationPath += Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName\$moduleVersion"
    } elseif ($ps5only) {
      $destinationPath += Join-Path -Path $env:ProgramFiles -ChildPath "PowerShell\Modules\$moduleName\$moduleVersion"
    } else {
      $destinationPath += Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName\$moduleVersion"
      $destinationPath += Join-Path -Path $env:ProgramFiles -ChildPath "PowerShell\Modules\$moduleName\$moduleVersion"
    }
    $destinationPath | ForEach-Object {
      $destpath = $_;
      if (Test-path $destPath) {
        Write-verbose "Taking ownership of path $($destpath) and setting permissions to ensure clean removal";
        $logDir = "$env:temp\logs"
        if (!(Test-Path $logDir)) {
            mkdir $logDir -ea 0;
        }
        $takeOwn = start-process -FilePath takeown.exe -ArgumentList "/F `"$($destPath)`" /R /A /D Y" -wait -NoNewWindow -PassThru -RedirectStandardOutput "$logDir\takeown-$modulename-paths.log"
        Write-Verbose "Take Ownership result is $($takeOwn | out-string) - $(Get-content "$logDir\takeown-$modulename-paths.log" | out-string)"
        #no need to keep the redirected output log that was output in verbose
        Remove-Item "$logDir\takeown-$modulename-paths.log" -force -Recurse -ea 0;
        try {
            #give full rights to path being deleted to authenticated users
            $perms = Grant-FullRightsToPath -path $destPath -recurseInherit -ea stop -wa 0 -wait -NoOutHost
            Write-Verbose "grant result is $($perms | out-string)"
        } catch {
            $perms = icacls "$($destPath)" /inheritance:e /grant "Authenticated Users:(OI)(CI)(F)" /T /C /Q
            Write-Verbose "Grant-fullrightstopath had an error, icacls native grant result is $($perms | out-string)"
        }
        try {
            if (Test-Path $destpath) {
                Write-Verbose "Attempting removal of version $moduleVersion of $moduleName installed at $($destpath)"
                [gc]::collect()
                [gc]::waitforpendingfinalizers()
                [gc]::collect()
                Remove-Item -Path $destpath -Force -Recurse -EA stop;
            } else {
                "No install for $modulename found at $($destpath)" | out-host;
            }
        } catch {
            Write-Warning "Version of $moduleName at $($destpath) could not be removed, most likely a dll was still loaded, attempting removal of all but dlls"
            
            Get-ChildItem $destpath -Exclude "*.dll" -Recurse | ForEach-Object {
                Remove-Item -path $destpath.FullName -force -ea 0;
            }
        }        
      }
      if (!$allversions) {
        #check if no other versions exist
        if ((Get-ChildItem ($destpath | Split-Path -Parent) -Directory -ea 0).count -eq 0) {
          Write-Warning "no versions remaining in $(($destpath | Split-Path -Parent).fullname) attempting to remove parent folder"
          ($destpath | Split-Path -Parent) | Remove-Item -Force -Recurse -ea 0
        }
      }
    }
  }

}
tools\LICENSE
 

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
FogApi Powershell Module 2506.9.22 7 Tuesday, June 17, 2025
Responded
FogApi Powershell Module 2506.9.21 7 Monday, June 16, 2025 Ready
FogApi Powershell Module 2506.9.20 7 Monday, June 16, 2025 Ready
FogApi Powershell Module 2506.9.19 8 Monday, June 16, 2025 Ready
FogApi Powershell Module 2411.9.17 57 Sunday, November 17, 2024 Approved
FogApi Powershell Module 2408.9.3 65 Monday, September 23, 2024 Approved

2506.9.21

Merge pull request #38 from darksidemilk/dev

fix -nosnapins paramset issues and scheduled task creation so send-fogimage can create scheduled deploy tasks correctly.

Full change log history available at https://fogapi.readthedocs.io/en/latest/ReleaseNotes/


This package has no dependencies.

Discussion for the FogApi Powershell Module Package

Ground Rules:

  • This discussion is only about FogApi Powershell Module and the FogApi Powershell Module package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or FogApi Powershell Module, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus