Skip to content

Functions

VertigoBot edited this page Apr 25, 2023 · 7 revisions

PSRedstone 2023.4.25.235 functions are fully documented in this article. This article has been made availble for your convenience and for easy searching. The same information is availble using the Get-Help function in PowerShell. The sections of this document have been automatically generated with platyPS and glued together into a single document. To review documentation for a previous version of PSRedstone, review the history.

Table of Contents:


Assert-RedstoneIsElevated

Is the current process elevated (running as administrator)?

SYNTAX

Assert-RedstoneIsElevated [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

Assert-IsElevated

Returns $true if you're running as an administrator.

PARAMETERS

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[bool]

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#assert-iselevated


Assert-RedstoneIsMutexAvailable

Wait, up to a timeout value, to check if current thread is able to acquire an exclusive lock on a system mutex.

SYNTAX

Assert-RedstoneIsMutexAvailable [-MutexName] <String> [[-MutexWaitTimeInMilliseconds] <Int32>]
 [<CommonParameters>]

DESCRIPTION

A mutex can be used to serialize applications and prevent multiple instances from being opened at the same time. Wait, up to a timeout (default is 1 millisecond), for the mutex to become available for an exclusive lock. This is an internal script function and should typically not be called directly.

EXAMPLES

EXAMPLE 1

Assert-IsMutexAvailable -MutexName 'Global\_MSIExecute' -MutexWaitTimeInMilliseconds 500

EXAMPLE 2

Assert-IsMutexAvailable -MutexName 'Global\_MSIExecute' -MutexWaitTimeInMilliseconds (New-TimeSpan -Minutes 5).TotalMilliseconds

EXAMPLE 3

Assert-IsMutexAvailable -MutexName 'Global\_MSIExecute' -MutexWaitTimeInMilliseconds (New-TimeSpan -Seconds 60).TotalMilliseconds

PARAMETERS

-MutexName

The name of the system mutex.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MutexWaitTimeInMilliseconds

The number of milliseconds the current thread should wait to acquire an exclusive lock of a named mutex. Default is: $Redstone.Settings.'Test-IsMutexAvailable'.MutexWaitTimeInMilliseconds A wait time of -1 milliseconds means to wait indefinitely. A wait time of zero does not acquire an exclusive lock but instead tests the state of the wait handle and returns immediately.

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 300000
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Boolean

NOTES

Copyright â'¸ 2015 - PowerShell App Deployment Toolkit Team

Copyright â'¸ 2023 - Raymond Piller (VertigoRay)

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions/#assert-ismutexavailable


Assert-RedstoneIsNonInteractiveShell

Is the current process running in a non-interactive shell?

SYNTAX

Assert-RedstoneIsNonInteractiveShell [<CommonParameters>]

DESCRIPTION

There are two ways to determine if the current process is in a non-interactive shell:

  • See if the user environment is marked as interactive.
  • See if PowerShell was launched with the -NonInteractive

EXAMPLES

EXAMPLE 1

Assert-IsNonInteractiveShell

If you're typing this into PowerShell, you should see $false.

PARAMETERS

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Boolean

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#assert-isnoninteractiveshell


Close-RedstoneProgram

Close the supplied process.

SYNTAX

Close-RedstoneProgram [-Process] <Process> [[-SleepSeconds] <Int32>] [<CommonParameters>]

DESCRIPTION

The supplied process is expected to be a program and have a visible window. This function will attempt to safely close the window before force killing the process. It's a little safer than just doing a Stop-Process -Force.

EXAMPLES

EXAMPLE 1

Get-Process code | Close-Program

EXAMPLE 2

$codes = Get-Process code; $codes | Close-Program -SleepSeconds [math]::Ceiling($codes.Count / 2)

PARAMETERS

-Process

Process to close.

Type: System.Diagnostics.Process
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-SleepSeconds

The number of seconds to wait after closing the main window before we force kill. If passing this in a pipeline, this is per pipeline item; otherwise, it is the wait time for all processes.

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 1
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS


Dismount-RedstoneRegistryHive

Dismount a registry hive.

SYNTAX

Dismount-RedstoneRegistryHive [[-Hive] <RegistryKey>]

DESCRIPTION

Dismount a hive to the registry.

EXAMPLES

EXAMPLE 1

Dismount-RegistryHive -Hive $hive

Where $hive was created with:

$hive = Mount-RegistryHive -DefaultUser

PARAMETERS

-Hive

The key object returned from Mount-RegistryHive.

Type: Microsoft.Win32.RegistryKey
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

[void]

NOTES

RELATED LINKS


Dismount-RedstoneWim

{{ Fill in the Synopsis }}

SYNTAX

Dismount-RedstoneWim [-MountPath] <DirectoryInfo> [-LogFileF <FileInfo>] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-LogFileF

Full path for the DISM log with {0} formatter to inject "DISM".

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MountPath

Path the WIM was mounted.

Type: System.IO.DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Void

NOTES

RELATED LINKS


Get-RedstoneExeFileInfo

Attempt to find the EXE in the provided Path.

SYNTAX

Get-RedstoneExeFileInfo [-Path] <String> [<CommonParameters>]

DESCRIPTION

This functions will go through three steps to find the provided EXE:

  • Determine if you provided the full path to the EXE or if it's in the current directory.
  • Determine if it can be found under any path in $env:PATH.
  • Determine if the locations was registered in the registry.

If one of these is true, it'll stop looking and return the IO.FileInfo of the EXE.

EXAMPLES

EXAMPLE 1

Get-ExeFileInfo 'notepad.exe'

EXAMPLE 2

Get-ExeFileInfo 'chrome.exe'

PARAMETERS

-Path

Name of the EXE to search for.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[IO.FileInfo]

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-exefileinfo


Get-RedstoneHashtableValue

This function is purely designed to make things easier when getting a value from a hashtable using a path in string form.

SYNTAX

Get-RedstoneHashtableValue [[-Hashtable] <Hashtable>] [[-Path] <String>] [[-Default] <Object>]

DESCRIPTION

This function is purely designed to make things easier when getting a value from a hashtable using a path in string form. It has the added benefit of returning a provided default value if the path doesn't exist.

EXAMPLES

EXAMPLE 1

Get-HashtableValue -Hashtable $vars -Path 'Thing2.This2.That1' -Default 'nope'

Returns 221 from the following $vars hashtable:

$vars = @{
    Thing1 = 1
    Thing2 = @{
        This1 = 21
        This2 = @{
            That1 = 221
            That2 = 222
            That3 = 223
            That4 = $null
        }
        This3 = 23
    }
    Thing3 = 3
}

EXAMPLE 2

Get-HashtableValue -Hashtable $vars -Path 'Thing2.This2.That4' -Default 'nope'

Returns $null from the following $vars hashtable:

$vars = @{
    Thing1 = 1
    Thing2 = @{
        This1 = 21
        This2 = @{
            That1 = 221
            That2 = 222
            That3 = 223
            That4 = $null
        }
        This3 = 23
    }
    Thing3 = 3
}

EXAMPLE 3

Get-HashtableValue -Hashtable $vars -Path 'Thing2.This4' -Default 'nope'

Returns "nope" from the following $vars hashtable:

$vars = @{
    Thing1 = 1
    Thing2 = @{
        This1 = 21
        This2 = @{
            That1 = 221
            That2 = 222
            That3 = 223
            That4 = $null
        }
        This3 = 23
    }
    Thing3 = 3
}

EXAMPLE 4

$redstone.GetVar('Thing2.This2.That4', 'nope')

When being used to access $redstone.Vars there's a built-in method that calls this function a bit easier. Returns $null from the following $redstone.Vars hashtable:

$redstone.Vars = @{
    Thing1 = 1
    Thing2 = @{
        This1 = 21
        This2 = @{
            That1 = 221
            That2 = 222
            That3 = 223
            That4 = $null
        }
        This3 = 23
    }
    Thing3 = 3
}

PARAMETERS

-Hashtable

{{ Fill Hashtable Description }}

Type: System.Collections.Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

{{ Fill Path Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Default

{{ Fill Default Description }}

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-hashtablevalue


Get-RedstoneInstalledApplication

Retrieves information about installed applications.

SYNTAX

Like (Default)

Get-RedstoneInstalledApplication [[-Name] <String[]>] [-CaseSensitive] [-WildCard] [-IncludeUpdatesAndHotfixes]
 [-UninstallRegKeys <String[]>] [<CommonParameters>]

Regex

Get-RedstoneInstalledApplication [[-Name] <String[]>] [-CaseSensitive] [-RegEx] [-IncludeUpdatesAndHotfixes]
 [-UninstallRegKeys <String[]>] [<CommonParameters>]

Exact

Get-RedstoneInstalledApplication [[-Name] <String[]>] [-CaseSensitive] [-Exact] [-IncludeUpdatesAndHotfixes]
 [-UninstallRegKeys <String[]>] [<CommonParameters>]

Eq

Get-RedstoneInstalledApplication [[-Name] <String[]>] [-CaseSensitive] [-IncludeUpdatesAndHotfixes]
 [-UninstallRegKeys <String[]>] [<CommonParameters>]

Productcode

Get-RedstoneInstalledApplication [-ProductCode <String>] [-IncludeUpdatesAndHotfixes]
 [-UninstallRegKeys <String[]>] [<CommonParameters>]

DESCRIPTION

Retrieves information about installed applications by querying the registry. You can specify an application name, a product code, or both. Returns information about application publisher, name & version, product code, uninstall string, quiet uninstall string, install source, location, date, and application architecture.

EXAMPLES

EXAMPLE 1

Get-InstalledApplication -Name 'Adobe Flash'

EXAMPLE 2

Get-InstalledApplication -ProductCode '{1AD147D0-BE0E-3D6C-AC11-64F6DC4163F1}'

PARAMETERS

-Name

The name of the application to retrieve information for. Performs a regex match on the application display name by default.

Type: System.String[]
Parameter Sets: Like, Regex, Exact, Eq
Aliases:

Required: False
Position: 1
Default value: *
Accept pipeline input: False
Accept wildcard characters: False

-CaseSensitive

{{ Fill CaseSensitive Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: Like, Regex, Exact, Eq
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Exact

Specifies that the named application must be matched using the exact name.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: Exact
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WildCard

Specifies that the named application must be matched using a wildcard search.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: Like
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-RegEx

{{ Fill RegEx Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: Regex
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProductCode

The product code of the application to retrieve information for.

Type: System.String
Parameter Sets: Productcode
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IncludeUpdatesAndHotfixes

Include matches against updates and hotfixes in results.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-UninstallRegKeys

Private Parameter; used for debug overrides.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: @(
            'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
            'HKLM:SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
        )
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[hashtable[]]

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-installedapplication


Get-RedstoneMsiExitCodeMessage

Get message for MSI error code

SYNTAX

Get-RedstoneMsiExitCodeMessage [-MsiExitCode] <Int32> [[-MsiLog] <String>] [<CommonParameters>]

DESCRIPTION

Get message for MSI error code by reading it from msimsg.dll

EXAMPLES

EXAMPLE 1

Get-MsiExitCodeMessage -MsiExitCode 1618

PARAMETERS

-MsiExitCode

{{ Fill MsiExitCode Description }}

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-MsiLog

MSI Log File. Parsed if ErrorCode is 1603.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

This is an internal script function and should typically not be called directly.

Copyright â'¸ 2015 - PowerShell App Deployment Toolkit Team

Copyright â'¸ 2023 - Raymond Piller (VertigoRay)

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-msiexitcodemessage


Get-RedstoneMsiTableProperty

Get all of the properties from a Windows Installer database table or the Summary Information stream and return as a custom object.

SYNTAX

TableInfo (Default)

Get-RedstoneMsiTableProperty [-Path] <String> [-TransformPath <String[]>] [-Table <String>]
 [-TablePropertyNameColumnNum <Int32>] [-TablePropertyValueColumnNum <Int32>] [-ContinueOnError <Boolean>]
 [<CommonParameters>]

SummaryInfo

Get-RedstoneMsiTableProperty [-Path] <String> [-TransformPath <String[]>] [-GetSummaryInformation]
 [-ContinueOnError <Boolean>] [<CommonParameters>]

DESCRIPTION

Use the Windows Installer object to read all of the properties from a Windows Installer database table or the Summary Information stream.

EXAMPLES

EXAMPLE 1

# Retrieve all of the properties from the default 'Property' table.

Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -TransformPath 'C:\Package\AppDeploy.mst' Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -TransformPath 'C:\Package\AppDeploy.mst'

EXAMPLE 2

# Retrieve all of the properties from the 'Property' table and then pipe to Select-Object to select the ProductCode property.

Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -TransformPath 'C:\Package\AppDeploy.mst' -Table 'Property' | Select-Object -ExpandProperty ProductCode Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -TransformPath 'C:\Package\AppDeploy.mst' -Table 'Property' | Select-Object -ExpandProperty ProductCode

EXAMPLE 3

# Retrieves the Summary Information for the Windows Installer database.

Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -GetSummaryInformation Get-MsiTableProperty -Path 'C:\Package\AppDeploy.msi' -GetSummaryInformation

PARAMETERS

-Path

The fully qualified path to an database file. Supports .msi and .msp files.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TransformPath

The fully qualified path to a list of MST file(s) which should be applied to the MSI file.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Table

The name of the the MSI table from which all of the properties must be retrieved. Default is: 'Property'.

Type: System.String
Parameter Sets: TableInfo
Aliases:

Required: False
Position: Named
Default value: $(if ([IO.Path]::GetExtension($Path) -eq '.msi') { 'Property' } else { 'MsiPatchMetadata' })
Accept pipeline input: False
Accept wildcard characters: False

-TablePropertyNameColumnNum

Specify the table column number which contains the name of the properties. Default is: 1 for MSIs and 2 for MSPs.

Type: System.Int32
Parameter Sets: TableInfo
Aliases:

Required: False
Position: Named
Default value: $(if ([IO.Path]::GetExtension($Path) -eq '.msi') { 1 } else { 2 })
Accept pipeline input: False
Accept wildcard characters: False

-TablePropertyValueColumnNum

Specify the table column number which contains the value of the properties. Default is: 2 for MSIs and 3 for MSPs.

Type: System.Int32
Parameter Sets: TableInfo
Aliases:

Required: False
Position: Named
Default value: $(if ([IO.Path]::GetExtension($Path) -eq '.msi') { 2 } else { 3 })
Accept pipeline input: False
Accept wildcard characters: False

-GetSummaryInformation

Retrieves the Summary Information for the Windows Installer database. Summary Information property descriptions: https://msdn.microsoft.com/en-us/library/aa372049(v=vs.85).aspx

Type: System.Management.Automation.SwitchParameter
Parameter Sets: SummaryInfo
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ContinueOnError

Continue if an error is encountered. Default is: $true.

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

This is an internal script function and should typically not be called directly.

Copyright â'¸ 2015 - PowerShell App Deployment Toolkit Team

Copyright â'¸ 2023 - Raymond Piller (VertigoRay)

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-msitableproperty


Get-RedstoneRegistryKeyAsArray

Recursively probe registry key's sub-key's and values and output a sorted array.

SYNTAX

Get-RedstoneRegistryKeyAsArray [[-Key] <String>] [[-Hive] <String>]

DESCRIPTION

Recursively probe registry key's sub-key's and values and output a sorted array.

EXAMPLES

EXAMPLE 1

Get-RecursiveRegistryKey 'SOFTWARE\Palo Alto Networks\GlobalProtect'

PARAMETERS

-Key

This is the key path within the hive. Do not include the Hive itself.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Hive

This is a top-level node in the registry as defined by RegistryHive Enum.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: LocalMachine
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-registrykeyasarray


Get-RedstoneRegistryKeyAsHashtable

Get the values in a registry key and all sub-keys.

SYNTAX

Get-RedstoneRegistryKeyAsHashtable [[-Key] <String>] [-Recurse]

DESCRIPTION

Get the values in a registry key and all sub-keys. This shouldn't be used to pull a massive section of the registry expecting perfect results.

There's a fundamental flaw that I'm unsure how to address with a hashtable. If there's a value and sub-key with the same name at the same key level, the sub-key won't be processed. Because of this, use this function to only return key sections with known/expected structures. Otherwise, consider using Get-RedstoneRegistryKeyAsArray.

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-Key

{{ Fill Key Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Recurse

{{ Fill Recurse Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-registrykeyashashtable


Get-RedstoneRegistryValueDoNotExpandEnvironmentName

Get a registry value without expanding environment variables.

SYNTAX

Get-RedstoneRegistryValueDoNotExpandEnvironmentName [[-Key] <String>] [[-Value] <String>] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

Get-RegistryValueDoNotExpandEnvironmentName 'HKCU:\Thing Foo'

PARAMETERS

-Key

{{ Fill Key Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Value

{{ Fill Value Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[bool]

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-registryvaluedonotexpandenvironmentname


Get-RedstoneRegistryValueOrDefault

SYNTAX

Get-RedstoneRegistryValueOrDefault [[-RegistryKey] <String>] [-RegistryValue] <String> [-DefaultData] <Object>
 [-RegistryKeyRoot <String>] [-DoNotExpand] [-OnlyUseDefaultSettings <Boolean>] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-RegistryKey

{{ Fill RegistryKey Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RegistryValue

{{ Fill RegistryValue Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DefaultData

{{ Fill DefaultData Description }}

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RegistryKeyRoot

{{ Fill RegistryKeyRoot Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DoNotExpand

Do Not Expand Environment Variables.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-OnlyUseDefaultSettings

For development.

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-registryvalueordefault


Get-RedstoneTranslatedErrorCode

SYNTAX

Get-RedstoneTranslatedErrorCode [-ErrorCode] <Win32Exception> [-MECM] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-ErrorCode

{{ Fill ErrorCode Description }}

Type: System.ComponentModel.Win32Exception
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MECM

{{ Fill MECM Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.ComponentModel.Win32Exception

NOTES

https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.win32exception

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#get-translatederrorcode


Get-RedstoneUserProfiles

Simplify the looping through user profiles and user registries.

SYNTAX

Get-RedstoneUserProfiles [[-Redstone] <Redstone>] [-AllProfiles] [[-DomainSid] <String>]
 [[-NotDomainSid] <String>] [-AddDefaultUser] [-IncludeUserRegKey]

DESCRIPTION

Simplify the looping through user profiles and user registries by calling this function that gets what you need quickly.

Each user profile that is returned will contain information in the following hashtable:

@{
    Domain = 'CONTOSO'
    Username = 'jsmith'
    Path = [IO.DirectoryInfo] 'C:\Users\jsmith'
    SID = 'S-1-5-21-1111111111-2222222222-3333333333-123456'
    RegistryKey = [Microsoft.Win32.RegistryKey] 'HKEY_USERS\S-1-5-21-1111111111-2222222222-3333333333-123456'
}

EXAMPLES

EXAMPLE 1

foreach ($profilePath in (Get-UserProfiles)) { $profilePath }

PARAMETERS

-Redstone

Provide the redstone class variable so we don't have to create a new one for you.

Type: Redstone
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AllProfiles

Include all user profiles, including service accounts. Otherwise just S-1-5-21 User Accounts would be included.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-DomainSid

Filter for the provided Sid. If an * is not included at the end, it will be added.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NotDomainSid

Filter out the provided Sid. If an * is not included at the end, it will be added.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AddDefaultUser

Include the default User. Keep in mind, no Domain or SID information will be provided for the default user, and the username will be DEFAULT.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-IncludeUserRegKey

{{ Fill IncludeUserRegKey Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

NOTES

RELATED LINKS


Install-RedstoneWindowsUpdateAdv

This is an advanced function for scheduling the install and reboot Windows Updates. It utilizes and augments functionality provided by PSWindowsUpdate.

SYNTAX

PSWindowsUpdate (Default)

Install-RedstoneWindowsUpdateAdv [-LastDeploymentChangeThresholdDays <Int32>] [-ScheduleJob <DateTime>]
 [-ScheduleReboot <DateTime>] [-ToastNotification <Hashtable>] [-FixWUAU] [<CommonParameters>]

NoPSWindowsUpdate

Install-RedstoneWindowsUpdateAdv [-NoPSWindowsUpdate] [-ToastNotification <Hashtable>] [-FixWUAU]
 [<CommonParameters>]

DESCRIPTION

This advanced function for installing Windows Updates will try to fix Windows Updates, if desired, and fail back to non-PowerShell mechanisms for forcing Windows Updates. It utilizes and augments functionality provided by PSWindowsUpdate.

If you want PSWindowsUpdate to send a report, you can use PSDefaultParameterValues to make that happen:

$PSDefaultParameterValues.Set_Item('Install-WindowsUpdate:SendReport', $true)
$PSDefaultParameterValues.Set_Item('Install-WindowsUpdate:SendHistory', $true)
$PSDefaultParameterValues.Set_Item('Install-WindowsUpdate:PSWUSettings', @{
    SmtpServer = 'smtp.sendgrid.net'
    Port = 465
    UseSsl = $true
    From = '{1} \<{0}@mailinator.com>' -f (& HOSTNAME.EXE), $env:ComputerName
    To = '[email protected]'
})

EXAMPLES

EXAMPLE 1

Install-WindowsUpdateAdv

This will install all available updates now and restart now.

EXAMPLE 2

Install-WindowsUpdateAdv -FixWUAU

This will attempt to fix the WUAU service, install all available updates now, and restart immediately afterwards.

EXAMPLE 3

Install-WindowsUpdateAdv -LastDeploymentChangeThresholdDays 30 -FixWUAU

This will attempt to fix the WUAU service, install all available updates now that are more than 30 days old, and restart immediately afterwards.

EXAMPLE 4

Install-WindowsUpdateAdv -LastDeploymentChangeThresholdDays 30 -FixWUAU -ScheduleJob ((Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-7) | Get-Date -Format 'O')

This will attempt to fix the WUAU service now, install all available updates today at 5 pm that are more than 30 days old, and restart immediately afterwards.

EXAMPLE 5

Install-WindowsUpdateAdv -LastDeploymentChangeThresholdDays 30 -FixWUAU -ScheduleJob ((Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-7) | Get-Date -Format 'O') -ScheduleReboot ((Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-1) | Get-Date -Format 'O')

This will attempt to fix the WUAU service now, install all available updates today at 5 pm that are more than 30 days old, and restart today at 11 pm.

EXAMPLE 6

Install-WindowsUpdateAdv -LastDeploymentChangeThresholdDays 30 -FixWUAU -ScheduleJob $scheduleJob -ScheduleReboot $scheduleReboot -ToastNotification $toastNotification

This will show a toast notification for any logged on users, attempt to fix the WUAU service now, install all available updates today at 5 pm that are more than 30 days old, and restart today at 11 pm. The variables were defined like this:

$scheduleJob = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-7) | Get-Date -Format 'O' # 5pm today
$scheduleReboot = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-1) | Get-Date -Format 'O' # 11pm today

$toastNotification  = @{
    ToastNotifier = 'Tech Solutions: Endpoint Solutions Engineering'
    ToastTitle = 'Windows Update'
    ToastText = 'This computer is at least 30 days overdue for {0} Windows Update{1}.
{2} being forced on your system {3}.
A reboot may occur {4}.'
    ToastTextFormatters = @(
        @($null, 's')
        @('The update is', 'Updates are')
        @(('on {0}' -f ($scheduleJob | Get-Date -Format (Get-Culture).DateTimeFormat.FullDateTimePattern)), 'now')
        @(('on {0}' -f ($scheduleReboot | Get-Date -Format (Get-Culture).DateTimeFormat.FullDateTimePattern)), 'immediately afterwards')
    )
}

EXAMPLE 7

Install-WindowsUpdateAdv -FixWUAU -NoPSWindowsUpdate

This will attempt to fix the WUAU service, install all available updates now, and restart immediately afterwards.

PARAMETERS

-LastDeploymentChangeThresholdDays

When using PSWindowsUpdate, this will check the LastDeploymentChangeTime and install updates past the threshold.

Type: System.Int32
Parameter Sets: PSWindowsUpdate
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-ScheduleJob

Schedule with a valid [datetime] value. I suggest using Get-Date -Format O to get a convertable string.

$scheduleJob = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-7) | Get-Date -Format 'O' # 5pm today
Type: System.DateTime
Parameter Sets: PSWindowsUpdate
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ScheduleReboot

Schedule with a valid [datetime] value. I suggest using Get-Date -Format O to get a convertable string.

$scheduleReboot = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-1) | Get-Date -Format 'O' # 11pm today
Type: System.DateTime
Parameter Sets: PSWindowsUpdate
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoPSWindowsUpdate

Do NOT install the PSWindowsUpdate module. When this option is used, none of the advanced scheduling or reporting options are available.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: NoPSWindowsUpdate
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ToastNotification

If this parameter is not provided, not Toast Notification will be shown. A hashtable used to splat into the PSRedstone Show-ToastNotification function.

The ToastText parameter will be formatted with:

$updateCount 1. $ToastNotification.ToastTextFormatters[0][$updateCount -gt 1] 2. $ToastNotification.ToastTextFormatters[1][$updateCount -gt 1] 3. $ToastNotification.ToastTextFormatters[2][$ScheduleJob -as [bool]] 4. $ToastNotification.ToastTextFormatters[3][$ScheduleReboot -as [bool]]

Here's an example:

$lastDeploymentChangeThresholdDays = 30
$scheduleJob = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-7) | Get-Date -Format 'O' # 5pm today
$scheduleReboot = (Get-Date -Format 'MM-dd-yyyy' | Get-Date).AddDays(1).AddHours(-1) | Get-Date -Format 'O' # 11pm today

$toastNotification  = @{
    ToastNotifier = 'Tech Solutions: Endpoint Solutions Engineering'
    ToastTitle = 'Windows Update'
    ToastText = 'This computer is at least 30 days overdue for {0} Windows Update{1}.
{2} being forced on your system {3}.
A reboot may occur {4}.'
    ToastTextFormatters = @(
        @($null, 's')
        @('The update is', 'Updates are')
        @(('on {0}' -f ($scheduleJob | Get-Date -Format (Get-Culture).DateTimeFormat.FullDateTimePattern)), 'now')
        @(('on {0}' -f ($scheduleReboot | Get-Date -Format (Get-Culture).DateTimeFormat.FullDateTimePattern)), 'immediately afterwards')
    )
}

When $toastNotification is passed to this function, and there are five Windows Updates past due, it will result in a Toast Notification like this:

Tech Solutions: Endpoint Solutions Engineering

Windows Update

This computer is at least 30 days overdue for 5 Windows Updates. Updates are being forced on your system on Saturday, February 11, 2023 5:00:00 PM. Reboot will occur on Saturday, February 11, 2023 11:00:00 PM.

Type: System.Collections.Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FixWUAU

Attempt to fix the WUAU service.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS


Invoke-RedstoneCmd

Runs the given command in ComSpec (aka: Command Prompt).

SYNTAX

Invoke-RedstoneCmd [-Cmd] <String> [-KeepOpen] [-StringMod] [-Quiet] [-DisableAutoRun] [-ANSI] [-Unicode]
 [<CommonParameters>]

DESCRIPTION

This just runs a command in ComSpec by passing it to Invoke-Run. If you don't need ComSpec to run the command, it's normally best to just use Invoke-Run.

Returns the same object as Invoke-Run

@{
    'Process' = $proc; # The result from Start-Process; as returned from `Invoke-Run`.
    'StdOut'  = $stdout;
    'StdErr'  = $stderr;
}

EXAMPLES

EXAMPLE 1

Invoke-Cmd "MKLINK /D Temp C:\Temp"

PARAMETERS

-Cmd

Under normal usage, the string passed in here just gets appended to cmd.exe /c .

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-KeepOpen

Applies /K instead of /C, but why would you want to do this?

/C Carries out the command specified by string and then terminates /K Carries out the command specified by string but remains

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-StringMod

Applies /S: Modifies the treatment of string after /C or /K (run cmd.exe below)

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Quiet

Applies /Q: Turns echo off

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-DisableAutoRun

Applies /D: Disable execution of AutoRun commands from registry (see below)

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ANSI

Applies /A: Causes the output of internal commands to a pipe or file to be ANSI

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Unicode

Applies /U: Causes the output of internal commands to a pipe or file to be Unicode

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[Hashtable] As returned from Invoke-Run.

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-cmd


Invoke-RedstoneDownload

Download a file and validate the checksum.

SYNTAX

OutFile (Default)

Invoke-RedstoneDownload [-Uri] <Uri> -OutFile <FileInfo> [-Checksum <String>] [<CommonParameters>]

OutFolder

Invoke-RedstoneDownload [-Uri] <Uri> -OutFolder <DirectoryInfo> [-Checksum <String>] [<CommonParameters>]

DESCRIPTION

Download a file; use a few methods based on performance preference testing:

  • Start-BitsTransfer
  • Net.WebClient
  • Invoke-WebRequest

If the first one fails, the next one will be tried. Target directory will be automatically created. A checksum will be validated if it is supplied.

EXAMPLES

EXAMPLE 1

Invoke-Download 'https://download3.vmware.com/software/CART23FQ4_WIN_2212/VMware-Horizon-Client-2212-8.8.0-21079405.exe' -OutFile (Join-Path $env:Temp 'VMware-Horizon-Client-2212-8.8.0-21079405.exe')

EXAMPLE 2

Invoke-Download 'https://download3.vmware.com/software/CART23FQ4_WIN_2212/VMware-Horizon-Client-2212-8.8.0-21079405.exe' -OutFolder $env:Temp

EXAMPLE 3

Invoke-Download 'https://download3.vmware.com/software/CART23FQ4_WIN_2212/VMware-Horizon-Client-2212-8.8.0-21079405.exe' -OutFolder $env:Temp -Checksum 'sha256:a0bac35619328f5f9aa56508572f343f7a388286768b31ab95377c37b052e5ac'

PARAMETERS

-Uri

Uri to the File to be downloaded.

Type: System.Uri
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-OutFile

The full path of the file to be downloaded.

Type: System.IO.FileInfo
Parameter Sets: OutFile
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-OutFolder

Folder where you want the file to go. If this is specified, the file name is derived from the last segment of the Uri parameter.

Type: System.IO.DirectoryInfo
Parameter Sets: OutFolder
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Checksum

A string containing the Algorithm and the Hash separated by a colon. For example: "SHA256:AA24A85644ECCCAD7098327899A3C827A6BE2AE1474C7958C1500DCD55EE66D8"

The algorithm should be a valid algorithm recognized by Get-FileHash.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-download


Invoke-RedstoneElevateCurrentProcess

Get SeTakeOwnership, SeBackup and SeRestore privileges before executes next lines, script needs Admin privilege

SYNTAX

Invoke-RedstoneElevateCurrentProcess [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

Ref: https://stackoverflow.com/a/35843420/17552750

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-elevatecurrentprocess


Invoke-RedstoneForceEmptyDirectory

SYNTAX

Invoke-RedstoneForceEmptyDirectory [-Path] <DirectoryInfo> [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

$MountPath.FullName | Invoke-ForceEmptyDirectory

PARAMETERS

-Path

Path to one or more locations.

Type: System.IO.DirectoryInfo
Parameter Sets: (All)
Aliases: PSPath

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-forceemptydirectory


Invoke-RedstoneMSI

Executes msiexec.exe to perform the following actions for MSI & MSP files and MSI product codes: install, uninstall, patch, repair, active setup.

SYNTAX

Invoke-RedstoneMSI [-Action <String>] [-Path] <String> [-Transforms <String[]>] [-Parameters <String[]>]
 [-SecureParameters] [-Patches <String[]>] [-LoggingOptions <String>] [-WorkingDirectory <String>]
 [-SkipMSIAlreadyInstalledCheck] [-MsiDisplay <String>] [-WindowStyle <String>] [-PassThru <Boolean>]
 [-LogFileF <String>] [<CommonParameters>]

DESCRIPTION

Executes msiexec.exe to perform the following actions for MSI & MSP files and MSI product codes: install, uninstall, patch, repair, active setup. If the -Action parameter is set to "Install" and the MSI is already installed, the function will exit. Sets default switches to be passed to msiexec based on the preferences in the XML configuration file. Automatically generates a log file name and creates a verbose log file for all msiexec operations. Expects the MSI or MSP file to be located in the "Files" sub directory of the App Deploy Toolkit. Expects transform files to be in the same directory as the MSI file.

EXAMPLES

EXAMPLE 1

# Installs an MSI

Invoke-MSI 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi'

EXAMPLE 2

# Installs an MSI, applying a transform and overriding the default MSI toolkit parameters

Invoke-MSI -Action 'Install' -Path 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi' -Transform 'Adobe_FlashPlayer_11.2.202.233_x64_EN_01.mst' -Parameters '/QN'

EXAMPLE 3

# Installs an MSI and stores the result of the execution into a variable by using the -PassThru option

[psobject] $ExecuteMSIResult = Invoke-MSI -Action 'Install' -Path 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi' -PassThru

EXAMPLE 4

# Uninstalls an MSI using a product code

Invoke-MSI -Action 'Uninstall' -Path '{26923b43-4d38-484f-9b9e-de460746276c}'

EXAMPLE 5

# Installs an MSP

Invoke-MSI -Action 'Patch' -Path 'Adobe_Reader_11.0.3_EN.msp'

EXAMPLE 6

$msi = @{

Action = 'Install' Parameters = @( 'USERNAME="{0}"' -f $settings.Installer.UserName 'COMPANYNAME="{0}"' -f $settings.Installer.CompanyName 'SERIALNUMBER="{0}"' -f $settings.Installer.SerialNumber ) }

if ([Environment]::Is64BitOperatingSystem) { Invoke-MSI @msi -Path 'Origin2016Sr2Setup32and64Bit.msi' } else { Invoke-MSI @msi -Path 'Origin2016Sr2Setup32Bit.msi' }

PARAMETERS

-Action

The action to perform. Options: Install, Uninstall, Patch, Repair, ActiveSetup.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Install
Accept pipeline input: False
Accept wildcard characters: False

-Path

The path to the MSI/MSP file or the product code of the installed MSI.

Type: System.String
Parameter Sets: (All)
Aliases: FilePath

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Transforms

The name of the transform file(s) to be applied to the MSI. Relational paths from the working dir, then the MSI are looked for ... in that order. Multiple transforms can be specified; separated by a comma.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Parameters

Overrides the default parameters specified in the XML configuration file. Install default is: "REBOOT=ReallySuppress /QB!". Uninstall default is: "REBOOT=ReallySuppress /QN".

Type: System.String[]
Parameter Sets: (All)
Aliases: Arguments

Required: False
Position: Named
Default value: @('REBOOT=ReallySuppress')
Accept pipeline input: False
Accept wildcard characters: False

-SecureParameters

Hides all parameters passed to the MSI or MSP file from the toolkit Log file.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Patches

The name of the patch (msp) file(s) to be applied to the MSI for use with the "Install" action. The patch file is expected to be in the same directory as the MSI file.

Type: System.String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LoggingOptions

Overrides the default logging options specified in the XML configuration file. Default options are: "/log" (aka: "/L*v")

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: /log
Accept pipeline input: False
Accept wildcard characters: False

-WorkingDirectory

Overrides the working directory. The working directory is set to the location of the MSI file.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $PWD.Path
Accept pipeline input: False
Accept wildcard characters: False

-SkipMSIAlreadyInstalledCheck

Skips the check to determine if the MSI is already installed on the system. Default is: $false.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-MsiDisplay

Overrides the default MSI Display Settings.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: /qn
Accept pipeline input: False
Accept wildcard characters: False

-WindowStyle

{{ Fill WindowStyle Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Hidden
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns ExitCode, StdOut, and StdErr output from the process.

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

-LogFileF

When using [Redstone], this will be overridden via $PSDefaultParameters.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: "${env:Temp}\Invoke-Msi.{1}.{0}.log"
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Collections.Hashtable

NOTES

Copyright (C) 2015 - PowerShell App Deployment Toolkit Team Copyright (C) 2023 - Raymond Piller (VertigoRay)

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-msi


Invoke-RedstoneObjectMethod

Invoke method on any object.

SYNTAX

Positional (Default)

Invoke-RedstoneObjectMethod [-InputObject] <Object> [-MethodName] <String> [[-ArgumentList] <Object[]>]
 [<CommonParameters>]

Named

Invoke-RedstoneObjectMethod [-InputObject] <Object> [-MethodName] <String> [-Parameter] <Hashtable>
 [<CommonParameters>]

DESCRIPTION

Invoke method on any object with or without using named parameters.

EXAMPLES

EXAMPLE 1

$ShellApp = New-Object -ComObject 'Shell.Application'

$null = Invoke-ObjectMethod -InputObject $ShellApp -MethodName 'MinimizeAll'

Minimizes all windows.

EXAMPLE 2

$ShellApp = New-Object -ComObject 'Shell.Application'

$null = Invoke-ObjectMethod -InputObject $ShellApp -MethodName 'Explore' -Parameter @{'vDir'='C:\Windows'}

Opens the C:\Windows folder in a Windows Explorer window.

PARAMETERS

-InputObject

Specifies an object which has methods that can be invoked.

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MethodName

Specifies the name of a method to invoke.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ArgumentList

Argument to pass to the method being executed. Allows execution of method without specifying named parameters.

Type: System.Object[]
Parameter Sets: Positional
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Parameter

Argument to pass to the method being executed. Allows execution of method by using named parameters.

Type: System.Collections.Hashtable
Parameter Sets: Named
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

This is an internal script function and should typically not be called directly.

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-objectmethod


Invoke-RedstonePesterDetect

Run a scriptblock that contains Pester tests that can be used for MECM Application Detection.

SYNTAX

Invoke-RedstonePesterDetect [-PesterScriptBlock] <ScriptBlock> [[-PesterScriptBlockParam] <Hashtable>]
 [[-PublisherProductVersion] <String>] [-DevMode] [<CommonParameters>]

DESCRIPTION

$ppv = 'VertigoRay Assert-IsElevated 1.2.3'
$sb = {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]
        $FunctionName
    )

    Describe $FunctionName {
        It 'Return Boolean' {
            {
                & $FunctionName | Should -BeOfType 'System.Boolean'
            } | Should -Not -Throw
        }
    }
}
$params = @{
    FunctionName = 'Assert-IsElevated'
}
Invoke-PesterDetect -PesterScriptBlock $sb -PesterScriptBlockParam $params -PublisherProductVersion $ppv

EXAMPLES

EXAMPLE 1

Invoke-PesterDetect -PesterScriptBlock $sb -PesterScriptBlockParam $params -PublisherProductVersion $ppv

This will run the PowerShell code block below returning ONLY the Detection SUCCESSFUL message if the detection was successful.

Detection SUCCESSFUL: VertigoRay Assert-IsElevated 1.2.3

It will return nothing if the detection failed. If you want to see where detection is failing, add the DevMode parameter.

Note: if your want to see what the variables are set to, take a look at the Description.

EXAMPLE 2

Invoke-PesterDetect -PesterScriptBlock $sb -PesterScriptBlockParam $params -PublisherProductVersion $ppv -DevMode

This will the pass with verbose output.

Pester v5.3.3

Starting discovery in 1 files.
Discovery found 1 tests in 25ms.
Running tests.
Describing Assert-IsElevated
  [+] Return Boolean 26ms (15ms|11ms)
Tests completed in 174ms
Tests Passed: 1, Failed: 0, Skipped: 0 NotRun: 0
Detection SUCCESSFUL: VertigoRay Assert-IsElevated 1.2.3

Note: if your want to see what the variables are set to, take a look at the Description.

EXAMPLE 3

Invoke-PesterDetect -PesterScriptBlock $sb -PesterScriptBlockParam @{ FunctionName = 'This-DoesNotExist' } -PublisherProductVersion $ppv -DevMode

This will fail with verbose output. This is useful in development, but you wouldn't want to send this to production. The reason is described in the DevMode parameter section.

Pester v5.4.0

Starting discovery in 1 files.
Discovery found 1 tests in 48ms.
Running tests.
Describing This-DoesNotExist
  [-] Return Boolean 250ms (241ms|9ms)
   Expected no exception to be thrown, but an exception "The term 'This-DoesNotExist' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again." was thrown from line:12 char:19
       +                 & $FunctionName | Should -BeOfType 'System.Boolean'
       +                   ~~~~~~~~~~~~~.
   at } | Should -Not -Throw, :13
   at \<ScriptBlock>, \<No file>:11
Tests completed in 593ms
Tests Passed: 0, Failed: 1, Skipped: 0 NotRun: 0
WARNING: [DEV MODE] Detection FAILED: VertigoRay Assert-IsElevated 1.2.3

Note: if your want to see what the variables are set to, take a look at the Description.

PARAMETERS

-PesterScriptBlock

Pass in a ScriptBlock that contains a fully functional Pester test. Here's a simple example of creating the ScriptBlock:

$sb = {
    Describe 'Assert-IsElevated' {
        It 'Return Boolean' {
            {
                Assert-IsElevated | Should -BeOfType 'System.Boolean'
            } | Should -Not -Throw
        }
    }
}
Invoke-PesterDetect -PesterScriptBlock $sb
Type: System.Management.Automation.ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PesterScriptBlockParam

This allows you to pass parameters into your ScriptBlock. Here's a simple example of creating the ScriptBlock with a parameter and passing a value into it. This PowerShell code is functionally identical to the code in the PesterScriptBlock parameter.:

$sb = {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]
        $FunctionName
    )

    Describe $FunctionName {
        It 'Return Boolean' {
            {
                & $FunctionName | Should -BeOfType 'System.Boolean'
            } | Should -Not -Throw
        }
    }
}
$params = @{
    FunctionName = 'Assert-IsElevated'
}
Invoke-PesterDetect -PesterScriptBlock $sb -PesterScriptBlockParam $params
Type: System.Collections.Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: @{}
Accept pipeline input: False
Accept wildcard characters: False

-PublisherProductVersion

This a string containing the Publisher, Product, and Version separated by spaces.

$PublisherProductVersion = "$($settings.Publisher) $($settings.Product) $($settings.Version)"

Really, you can provide whatever you want here, whatever you provide will be put on the end of a successful detection message. For example, if you set this to "Peanut Brittle" because you think it's amusing, your successful detection message will be:

Detection SUCCESSFUL: Peanut Brittle

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: :)
Accept pipeline input: False
Accept wildcard characters: False

-DevMode

This script allows additional output when you're in you development environment. This is important to address because detections scripts have very strict StdOut requirements.

$devMode = if ($MyInvocation.MyCommand.Name -eq 'detect.ps1') { $true } else { $false }

This example assumes that in your development environment, you've named your detections script detect.ps1. This is the InvocationName when we running the dev version of the script, like in Windows Sandbox. When SCCM calls detection, the detection script is put in a file named as a guid. i.e. fae94777-2c0d-4dd0-94f0-407f7cd07858.ps1

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS


Invoke-RedstoneRegistryTakeOwnership

SYNTAX

Invoke-RedstoneRegistryTakeOwnership [[-RootKey] <String>] [-Key] <String> [[-Sid] <SecurityIdentifier>]
 [[-Recurse] <Boolean>] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-RootKey

{{ Fill RootKey Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Key

{{ Fill Key Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Sid

{{ Fill Sid Description }}

Type: System.Security.Principal.SecurityIdentifier
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Recurse

{{ Fill Recurse Description }}

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Boolean

NOTES

Ref: https://stackoverflow.com/a/35843420/17552750

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-registrytakeownership


Invoke-RedstoneRun

Runs the given command.

SYNTAX

Cmd

Invoke-RedstoneRun [-Cmd] <String> [-CaptureConsoleOut] [-WorkingDirectory <String>] [-PassThru <Boolean>]
 [-Wait <Boolean>] [-WindowStyle <String>] [-LogFile <FileInfo>] [<CommonParameters>]

FilePath

Invoke-RedstoneRun -FilePath <String> [-ArgumentList <String[]>] [-CaptureConsoleOut]
 [-WorkingDirectory <String>] [-PassThru <Boolean>] [-Wait <Boolean>] [-WindowStyle <String>]
 [-LogFile <FileInfo>] [<CommonParameters>]

DESCRIPTION

This command sends a single command to Start-Process in a way that is standardized. For convenience, you can use the Cmd parameter, passing a single string that contains your executable and parameters; see examples.

The command will return a [hashtable] including the Process results, standard output, and standard error:

@{
    'Process' = $proc; # The result from Start-Process.
    'StdOut'  = $stdout; # This is an array, as returned from `Get-Content`.
    'StdErr'  = $stderr; # This is an array, as returned from `Get-Content`.
}

This function has been vetted for several years, but if you run into issues, try using Start-Process.

EXAMPLES

EXAMPLE 1

$result = Invoke-Run """${firefox_setup_exe}"" /INI=""${ini}"""

Use Cmd parameter

EXAMPLE 2

$result = Invoke-Run -FilePath $firefox_setup_exe -ArgumentList @("/INI=""${ini}""")

Use FilePath and ArgumentList parameters

EXAMPLE 3

$result.Process.ExitCode

Get the ExitCode

PARAMETERS

-Cmd

This is the command you wish to run, including arguments, as a single string.

Type: System.String
Parameter Sets: Cmd
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FilePath

Specifies the optional path and file name of the program that runs in the process. Enter the name of an executable file or of a document, such as a .txt or .doc file, that is associated with a program on the computer.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.String
Parameter Sets: FilePath
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ArgumentList

Specifies parameters or parameter values to use when this cmdlet starts the process.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.String[]
Parameter Sets: FilePath
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CaptureConsoleOut

{{ Fill CaptureConsoleOut Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WorkingDirectory

Specifies the location of the executable file or document that runs in the process. The default is the current folder.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns a process object for each process that the cmdlet started. By default, this cmdlet does generate output.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

-Wait

Indicates that this cmdlet waits for the specified process to complete before accepting more input. This parameter suppresses the command prompt or retains the window until the process finishes.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

-WindowStyle

Specifies the state of the window that is used for the new process. The acceptable values for this parameter are: Normal, Hidden, Minimized, and Maximized.

Passes Directly to Start-Process; see Get-Help Start-Process.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Hidden
Accept pipeline input: False
Accept wildcard characters: False

-LogFile

{{ Fill LogFile Description }}

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[hashtable]

NOTES

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#invoke-run


Invoke-RedstoneTouch

Touch - change file timestamps.

SYNTAX

Now (Default)

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-NoCreate] [-PassThru] [<CommonParameters>]

ReferenceWriteTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-NoCreate] [-WriteTimeOnly] [-Reference <FileInfo>] [-PassThru]
 [<CommonParameters>]

ReferenceAccessTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-AccessTimeOnly] [-NoCreate] [-Reference <FileInfo>] [-PassThru]
 [<CommonParameters>]

DateWriteTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-NoCreate] [-Date <DateTime>] [-WriteTimeOnly] [-PassThru]
 [<CommonParameters>]

DateAccessTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-AccessTimeOnly] [-NoCreate] [-Date <DateTime>] [-PassThru]
 [<CommonParameters>]

NowWriteTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-NoCreate] [-WriteTimeOnly] [-PassThru] [<CommonParameters>]

NowAccessTimeOnly

Invoke-RedstoneTouch [-Path] <FileInfo[]> [-AccessTimeOnly] [-NoCreate] [-PassThru] [<CommonParameters>]

DESCRIPTION

Update the access and modification times of the Path to the current time. A path argument that does not exist is created empty, unless -c or is supplied.

EXAMPLES

EXAMPLE 1

Invoke-Touch 'C:\Temp\foo.txt'

Update the access and modification times of foo.txt to the current time.

EXAMPLE 2

Get-ChildItem $env:Temp -File | Invoke-Touch

Update the access and modification times of all files in the temp directory to the current time. Not specifying the -File parameter may cause directories to be passed in; this will cause a ParameterBindingException to be thrown.

EXAMPLE 3

Get-ChildItem $env:Temp -File | Invoke-Touch -PassThru | Invoke-MoreActions

Update the access and modification times of all files in the temp directory to the current time and pass the file info through on the pipeline. Not specifying the -File parameter may cause directories to be passed in; this will cause a ParameterBindingException to be thrown.

PARAMETERS

-Path

Specifies a path to a file.

Type: System.IO.FileInfo[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-AccessTimeOnly

Change only the access time.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: ReferenceAccessTimeOnly, DateAccessTimeOnly, NowAccessTimeOnly
Aliases: a

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-NoCreate

Do not create any files.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: c

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Date

Use instead of current time.

Type: System.DateTime
Parameter Sets: DateWriteTimeOnly, DateAccessTimeOnly
Aliases: d

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WriteTimeOnly

Change only the modification time.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: ReferenceWriteTimeOnly, DateWriteTimeOnly, NowWriteTimeOnly
Aliases: m

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Reference

Use this file's times instead of current time.

Type: System.IO.FileInfo
Parameter Sets: ReferenceWriteTimeOnly, ReferenceAccessTimeOnly
Aliases: r

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Return the IO.FileInfo for the touched file.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.IO.FileInfo

NOTES

Ref:

RELATED LINKS


Mount-RedstoneRegistryHive

Mount a registry hive.

SYNTAX

Mount-RedstoneRegistryHive [[-FilePath] <FileInfo>] [[-Hive] <String>] [-DefaultUser] [-DoNotAutoDismount]

DESCRIPTION

Mount a hive to the registry. Return the destination in the registry where the hive was mounted.

If the DefaultUser parameter is provided, then all other parameters are discarded.

EXAMPLES

EXAMPLE 1

$hive = Mount-RegistryHive -DefaultUser

EXAMPLE 2

$hive = Mount-RegistryHive -FilePath 'C:\Temp\NTUSER.DAT'

EXAMPLE 3

$hive = Mount-RegistryHive -FilePath 'C:\Temp\NTUSER.DAT' -Hive 'HKEY_USERS\TEMP'

EXAMPLE 4

$hive = Mount-RegistryHive -FilePath 'C:\Temp\NTUSER.DAT' -Hive 'HKEY_USERS\THING{0}'

PARAMETERS

-FilePath

The path to the hive file.

If the DefaultUser parameter is provided, then this parameter is discarded.

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Hive

Registry location where to mount the hive. If {0} is provided, a formatter will provide some randomness to the location.

If the DefaultUser parameter is provided, then this parameter is discarded.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: HKEY_USERS\TEMP{0}
Accept pipeline input: False
Accept wildcard characters: False

-DefaultUser

Optionally, provide just this switch to mount the Default User hive.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-DoNotAutoDismount

{{ Fill DoNotAutoDismount Description }}

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

[Microsoft.Win32.RegistryKey]

NOTES

RELATED LINKS


Mount-RedstoneWim

{{ Fill in the Synopsis }}

SYNTAX

Mount-RedstoneWim [-ImagePath] <FileInfo> [[-MountPath] <DirectoryInfo>] [-ImageIndex <Int32>]
 [-DoNotAutoDismount] [-LogFileF <FileInfo>] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-DoNotAutoDismount

Do not auto-dismount when PowerShell exits.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ImageIndex

Image index to mount.

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ImagePath

Path to the WIM file.

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases: PSPath

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LogFileF

Full path for the DISM log with {0} formatter to inject "DISM".

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MountPath

Path the WIM will be mounted.

Type: System.IO.DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.IO.DirectoryInfo

NOTES

RELATED LINKS


New-RedstoneRedstone

Create a RedStone Class.

SYNTAX

NoParams (Default)

New-RedstoneRedstone [-WhatIf] [-Confirm] [<CommonParameters>]

SettingsJson

New-RedstoneRedstone [-SettingsJson] <FileInfo> [-WhatIf] [-Confirm] [<CommonParameters>]

Settings

New-RedstoneRedstone [-Settings] <PSObject> [-WhatIf] [-Confirm] [<CommonParameters>]

ManuallyDefined

New-RedstoneRedstone [-Publisher] <String> [-Product] <String> [-Version] <String> [-Action] <String> [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

Create a Redstone Class with an easy to use function.

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-SettingsJson

Path to the settings.json file.

Type: System.IO.FileInfo
Parameter Sets: SettingsJson
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Settings

Pre-existing settings variable.

Type: System.Management.Automation.PSObject
Parameter Sets: Settings
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Publisher

Name of the publisher, like "Mozilla".

Type: System.String
Parameter Sets: ManuallyDefined
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Product

Name of the product, like "Firefox ESR".

Type: System.String
Parameter Sets: ManuallyDefined
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Version

Version of the product, like "108.0.1". This was deliberatly not cast as a [version] to allow handling of non-semantic versioning.

Type: System.String
Parameter Sets: ManuallyDefined
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Action

Action that is being taken. This is purely cosmetic and directly affects the log name. For Example: - Using the examples from the Publisher, Product, and Version parameters. - Set action to 'install'

The log file name will be: Mozilla Firefox ESR 108.0.1 Install.log

If you don't specify an action, the action will be taken from the name of the script your calling this function from.

Type: System.String
Parameter Sets: ManuallyDefined
Aliases:

Required: True
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

``System.Array with two Values: ` 1. Redstone. The Redstone class` ` 2. PSObject. The results of parsing the provided settings.json file. Null if parameters supplied.`

NOTES

Allows access to the Redstone class without having to use Using Module Redstone. - Ref: https://stephanevg.github.io/powershell/class/module/DATA-How-To-Write-powershell-Modules-with-classes/

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#new-redstone


New-RedstoneScheduledTaskTriggerLogonRunAsUser

Create Scheduled Task that runs at logon for any user that logs on.

SYNTAX

New-RedstoneScheduledTaskTriggerLogonRunAsUser [[-TaskName] <String>] [[-Description] <String>]
 [-Path] <FileInfo> [[-Arguments] <String>] [-WorkingDirectory] <DirectoryInfo> [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Create Scheduled Task that runs at logon for any user that logs on. This uses the Schedule Service COM Obect because the ScheduledTasks module doesn't allow you to set "all users".

For other, less specific sceduled tasks needs, just use the ScheduledTasks module. There's no reason to replace the work done on that module; this just makes this one thing a little easier.

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-TaskName

The name of the task. If this value is NULL, the task will be registered in the root task folder and the task name will be a GUID value created by the Task Scheduler service.

A task name cannot begin or end with a space character. The '.' character cannot be used to specify the current task folder and the '..' characters cannot be used to specify the parent task folder in the path.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

Sets the description of the task.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path

Sets the path to an executable file.

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Arguments

Sets the arguments associated with the command-line operation.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WorkingDirectory

Sets the directory that contains either the executable file or the files that are used by the executable file.

Type: System.IO.DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

  • Triggers Create:
    • TASK_TRIGGER_LOGON (9): Triggers the task when a specific user logs on.
  • Actions Create:
    • TASK_ACTION_EXEC (0): The action performs a command-line operation. For example, the action could run a script, launch an executable, or, if the name of a document is provided, find its associated application and launch the application with the document.
      • ExecAction:
        • Path: Sets the path to an executable file.
        • Arguments: Sets the arguments associated with the command-line operation.
        • WorkingDirectory: Sets the directory that contains either the executable file or the files that are used by the executable file.
  • RegisterTaskDefinition: TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD (6)
    • Path: See TaskName parameter description.
    • Definition: The definition of the registered task.
    • Flags: 6
      • TASK_CREATE (0x2): The Task Scheduler service registers the task as a new task.
      • TASK_UPDATE (0x4): The Task Scheduler service registers the task as an updated version of an existing task. When a task with a registration trigger is updated, the task will execute after the update occurs.
    • UserId: The user credentials used to register the task. If present, these credentials take priority over the credentials specified in the task definition object pointed to by the Definition parameter.
    • LogonType: Defines what logon technique is used to run the registered task.
      • TASK_LOGON_GROUP (4): Group activation. The groupId field specifies the group.

RELATED LINKS


New-RedstoneWim

{{ Fill in the Synopsis }}

SYNTAX

New-RedstoneWim [-ImagePath] <FileInfo> [-CapturePath] <DirectoryInfo> [-Name] <String>
 [[-LogFileF] <FileInfo>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-CapturePath

{{ Fill CapturePath Description }}

Type: System.IO.DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ImagePath

{{ Fill ImagePath Description }}

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LogFileF

{{ Fill LogFileF Description }}

Type: System.IO.FileInfo
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

{{ Fill Name Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Void

NOTES

RELATED LINKS


Set-RedstoneRegistryHiveItemProperty

Run Set-ItemProperty on a mounted registry hive.

SYNTAX

Set-RedstoneRegistryHiveItemProperty [[-Hive] <RegistryKey>] [[-Key] <String>] [[-Value] <String>]
 [[-Type] <String>] [[-Data] <Object>]

DESCRIPTION

Run Set-ItemProperty on a mounted registry hive. This process is non-trivial as it requires us to close handles after creating keys and do garbage cleanup when we're done. Doing these extra steps allows unloading/dismounting of the hive. Return the resulting ItemProperty.

EXAMPLES

EXAMPLE 1

$result = Set-RegistryHiveItemProperty -Hive $hive -Key 'Policies\Microsoft\Windows\Personalization' -Value 'NoChangingSoundScheme' -Type 'String' -Data 1

Where $hive was created with:

$hive = Mount-RegistryHive -DefaultUser

PARAMETERS

-Hive

The key object returned from Mount-RegistryHive.

Type: Microsoft.Win32.RegistryKey
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Key

Key path, within the hive, to edit. This will be concatinated with the hive. A leading \\ will be stripped.

If the Hive parameter is not provided, this should be the full Key. Do NOT use PSDrive references like HKCU: or HKLM:. Instead use normal registry paths, like HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Value

Specifies the name of the property.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Type

This is a dynamic parameter made available by the Registry provider. The Registry provider and this parameter are only available on Windows.

A registry type (aka RegistryValueKind) as expected when using Set-ItemProperty.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Data

Specifies the value of the property.

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

INPUTS

OUTPUTS

[PSCustomObject]

NOTES

RELATED LINKS


Set-RedstoneRegsitryKeyPermissions

SYNTAX

Set-RedstoneRegsitryKeyPermissions [[-RootKey] <String>] [[-Key] <String>] [[-Sid] <SecurityIdentifier>]
 [[-Recurse] <Boolean>] [[-RecurseLevel] <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

Example 1

PS C:> {{ Add example code here }}

{{ Add example description here }}

PARAMETERS

-RootKey

{{ Fill RootKey Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Key

{{ Fill Key Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Sid

{{ Fill Sid Description }}

Type: System.Security.Principal.SecurityIdentifier
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Recurse

{{ Fill Recurse Description }}

Type: System.Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-RecurseLevel

{{ Fill RecurseLevel Description }}

Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

Ref: https://stackoverflow.com/a/35843420/17552750

RELATED LINKS

https://github.com/VertigoRay/PSRedstone/wiki/Functions#set-regsitrykeypermissions


Show-RedstoneToastNotification

SYNTAX

Show-RedstoneToastNotification [-ToastNotifier] <String> [-ToastTitle] <String> [-ToastText] <String>
 [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

Show-ToastNotification @toastNotification

This displays a toast notification.

if ($ScheduleJob) { $jobTimespan = New-TimeSpan -Start ([datetime]::Now) -End $ScheduleJob }
if ($ScheduleReboot) { $rebootTimespan = New-TimeSpan -Start ([datetime]::Now) -End $ScheduleReboot }

$toastNotification  = @{
    ToastNotifier = 'Tech Solutions: Endpoint Solutions Engineering'
    ToastTitle = 'Windows Update'
    ToastText =  'This computer is overdue for {0} Windows Update{1} and the time threshold has exceeded.
{2} being forced on your system {3}.{4}' -f @(
        $updateCount
        $(if ($updateCount -gt 1) { 's' } else { $null })
        $(if ($updateCount -eq 1) { 'Updates are' } else { 'The update is' })
        $(if ($ScheduleJob) { 'on {0}' -f $ScheduleJob } else { 'now' })
        $(if ($ScheduleReboot) { ' Reboot will occur on {0}.' -f $ScheduleReboot } else { $null })
    )
}

Show-ToastNotification @toastNotification

PARAMETERS

-ToastNotifier

{{ Fill ToastNotifier Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ToastTitle

{{ Fill ToastTitle Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ToastText

{{ Fill ToastText Description }}

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS


Stop-RedstoneProcessTree

Kill a process and all of its child processes.

SYNTAX

Process

Stop-RedstoneProcessTree [-InputObject] <PSObject> [-Force] [<CommonParameters>]

ProcessId

Stop-RedstoneProcessTree [-Id] <Int32> [-Force] [<CommonParameters>]

ProcessName

Stop-RedstoneProcessTree [-Name] <String> [-Force] [<CommonParameters>]

DESCRIPTION

Kill a process and all of its child processes. Returns any processes that failed to stop; returning nothing if everything stopped sucessfully.

EXAMPLES

EXAMPLE 1

$stillRunning = Get-Process 'overwolf' | Stop-ProcessTree -Force

EXAMPLE 2

$stillRunning = Stop-ProcessTree -Id 12345 -Force

EXAMPLE 3

$stillRunning = Stop-ProcessTree -Name 'overwolf' -Force

PARAMETERS

-InputObject

Provide a Process Object

Type: System.Management.Automation.PSObject
Parameter Sets: Process
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Id

Provide a Process ID

Type: System.Int32
Parameter Sets: ProcessId
Aliases:

Required: True
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-Name

Provide a Process Name

Type: System.String
Parameter Sets: ProcessName
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Force the Stop-Process

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Diagnostics.Process

NOTES

RELATED LINKS

Clone this wiki locally