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:

69

Downloads of v 2408.9.3:

48

Last Update:

23 Sep 2024

Package Maintainer(s):

Software Author(s):

  • JJ Fullmer
  • FOG Project

Tags:

psmodule fog fogapi imaging provisioning fogproject

FogApi Powershell Module

This is not the latest version of FogApi Powershell Module available.

  • 1
  • 2
  • 3

2408.9.3 | Updated: 23 Sep 2024

Downloads:

69

Downloads of v 2408.9.3:

48

Maintainer(s):

Software Author(s):

  • JJ Fullmer
  • FOG Project

FogApi Powershell Module 2408.9.3

This is not the latest version of FogApi Powershell Module available.

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
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install FogApi Powershell Module, run the following command from the command line or from PowerShell:

>

To upgrade FogApi Powershell Module, run the following command from the command line or from PowerShell:

>

To uninstall FogApi Powershell Module, run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade fogapi -y --source="'INTERNAL REPO URL'" --version="'2408.9.3'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade fogapi -y --source="'INTERNAL REPO URL'" --version="'2408.9.3'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install fogapi
  win_chocolatey:
    name: fogapi
    version: '2408.9.3'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'fogapi' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '2408.9.3'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller fogapi
{
    Name     = "fogapi"
    Version  = "2408.9.3"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'fogapi':
  ensure   => '2408.9.3',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved by moderator flcdrg on 14 Nov 2024.

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),
removing any other existing versions to avoid conflicts.
The uninstall script removes the specific version installed via Chocolatey.
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) - Do not remove other versions. Defaults to false.
  • /RemoveAll: (true/false) - 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.
The first time you try to run a command the settings.json file will automatically open
in notepad on windows, nano on linux, or TextEdit on Mac
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 have a jolly good time utilzing the fog documentation
found here https://news.fogproject.org/simplified-api-documentation/ that was used to model the parameters

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/2408.9.3/fogapi.2408.9.3.IncludeXml.zip"
    Checksum = '466582455D0E0905A46D51F8AE2BD0E6505E5D9559F6C6C86752602AAA4474AD'
    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

$destinationRootPath = New-Object -TypeName 'System.Collections.generic.list[System.Object]';
if($pp.PS7Only) {
    $destinationRootPath.add((Join-Path -Path $env:ProgramFiles -ChildPath "PowerShell\Modules\$moduleName"))
    "Installing $modulename version $moduleVersion in pwsh 7+ system path only" | out-host;
} elseif ($pp.PS5Only) {
    $destinationRootPath.add((Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName"))
    "Installing $modulename version $moduleVersion in windows powershell 5.1 system path only" | out-host;
} else {
    #ps 5.1 installed system mods
    $destinationRootPath.add((Join-Path -Path $env:ProgramFiles -ChildPath "WindowsPowerShell\Modules\$moduleName"))
    #ps 7 installed system mods
    $destinationRootPath.add((Join-Path -Path $env:ProgramFiles -ChildPath "PowerShell\Modules\$moduleName"))
    "Installing $modulename version $moduleVersion in both pwsh 7+ and windows powershell 5.1 system paths" | out-host;
}
 
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 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).FullName;
            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
-----------------------------------------------------------------------------
"@
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;
  }
  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;
          }
      }        
    }
  }
}

}
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 2408.9.3 48 Monday, September 23, 2024 Approved

2408.9.3

Fix choco package building issue where not all files were being properly included in the package

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