34 lines
886 B
PowerShell
34 lines
886 B
PowerShell
function Save-MachineManifest {
|
|
<#
|
|
.SYNOPSIS
|
|
Saves a json manifest to the specified location. Defaults to c:\temp\manifest if not supplied
|
|
|
|
.EXAMPLE
|
|
Save-MachineManifest
|
|
|
|
This will save a manifest for the local machine at c:\temp\manifest
|
|
|
|
Save-MachineManifest -Folder "c:\temp\foo"
|
|
|
|
This will save a manifest of the local machine to "c:\temp\foo"
|
|
|
|
.PARAMETER outputFolder
|
|
Optional output location
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $false)]
|
|
[Alias("Folder")]
|
|
[string]$outputFolder = "c:\temp\manifest"
|
|
)
|
|
|
|
if(!(Test-Path $outputFolder))
|
|
{
|
|
New-Item -Path $defaultTempFileLocation -ItemType "directory"
|
|
}
|
|
|
|
$filename = "$outputFolder\$env:computername.json"
|
|
Get-MachineInventory -filter chocolatey -asJson | Out-File -FilePath $filename
|
|
}
|