Skip to main content
Version: 4.1.x

Set-ADTIniSection

SYNOPSIS

Opens an INI file and sets the values of the specified section.

SYNTAX

Set-ADTIniSection [-FilePath] <String> [-Section] <String> [-Content] <IDictionary> [-Overwrite] [-Force]
[<CommonParameters>]

DESCRIPTION

Opens an INI file and sets the values of the specified section.

EXAMPLES

EXAMPLE 1

Set-ADTIniSection -FilePath "$env:ProgramFilesX86\IBM\Notes\notes.ini" -Section 'Notes' -Content ([ordered]@{'KeyFileName' = 'MyFile.ID'; 'KeyFileType' = 'ID'})

Adds the provided content to the 'Notes' section, preserving input order

EXAMPLE 2

Set-ADTIniSection -FilePath "$env:ProgramFilesX86\IBM\Notes\notes.ini" -Section 'Notes' -Content @{'KeyFileName' = 'MyFile.ID'} -Overwrite

Overwrites the 'Notes' section to only contain the content specified.

EXAMPLE 3

Set-ADTIniSection -FilePath "$env:ProgramFilesX86\IBM\Notes\notes.ini" -Section 'Notes' -Content $null -Overwrite

Sets the 'Notes' section to be empty by sending null content in combination with the -Overwrite switch.

PARAMETERS

-FilePath

Path to the INI file.

Type: String
Parameter Sets: (All)
Aliases:

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

-Section

Section within the INI file.

Type: String
Parameter Sets: (All)
Aliases:

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

-Content

A hashtable or dictionary object containing the key-value pairs to set in the specified section. Supply an ordered hashtable to preserve the order of supplied entries. Values can be strings, numbers, booleans, enums, or null. Supply $null or an empty hashtable in combination with -Overwrite to empty an entire section.

Type: IDictionary
Parameter Sets: (All)
Aliases:

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

-Overwrite

Specifies whether the provided INI content should overwrite all existing section content.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Force

Specifies whether the INI file should be created if it does not already exist.

Type: 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

None

You cannot pipe objects to this function.

OUTPUTS

None

This function does not return any output.

NOTES

An active ADT session is NOT required to use this function.

Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0

https://psappdeploytoolkit.com/docs/reference/functions/Set-ADTIniSection

Look for us at these events...

MMS: Music City Edition 2025
October 12th to 15th • Nashville, Tennessee, USA
Up Next
AppManage2025AppManage2025
October 10th • Utrecht, The Netherlands
MAEDS Fall Conference 2025MAEDS Fall Conference 2025
October 29th to 31st • Michigan, USA
Morty Proxy This is a proxified and sanitized view of the page, visit original site.