< Back

Update-GptIniVersion

Sat Jan 18, 2020 7:23 pm

NAME Update-GptIniVersion



SYNOPSIS

Increments the version counter in a gpt.ini file.





SYNTAX

Update-GptIniVersion [-Path] <String> [-PolicyType] <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Increments the version counter in a gpt.ini file.





PARAMETERS

-Path <String>

Path to the gpt.ini file that is to be modified.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PolicyType <String[]>

Can be set to either 'Machine', 'User', or both. This affects how the value of the Version number in the ini

file is changed.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None. This command does not accept pipeline input.





OUTPUTS

None. This command does not generate output.





NOTES





A gpt.ini file contains only a single Version value. However, this represents two separate counters, for

machine and user versions.

The high 16 bits of the value are the User counter, and the low 16 bits are the Machine counter. For example

(on PowerShell 3.0

and later), the Version value when the Machine counter is set to 3 and the User counter is set to 5 can be

found by evaluating this

expression: (5 -shl 16) -bor 3 , which will show up as decimal value 327683 in the INI file.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Update-GptIniVersion -Path $env:SystemRoot\\system32\\GroupPolicy\\gpt.ini -PolicyType Machine



Increments the Machine version counter of the local GPO.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Update-GptIniVersion -Path $env:SystemRoot\\system32\\GroupPolicy\\gpt.ini -PolicyType User



Increments the User version counter of the local GPO.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Update-GptIniVersion -Path $env:SystemRoot\\system32\\GroupPolicy\\gpt.ini -PolicyType Machine,User



Increments both the Machine and User version counters of the local GPO.











RELATED LINKS

Get-PolicyFileEntry

Set-PolicyFileEntry

Remove-PolicyFileEntry

about_RegistryValuesForAdminTemplates