Tag Archives: Force

Copy-Item

NAME
    Copy-Item

SYNOPSIS
    Copies an item from one location to another within a namespace.

SYNTAX
    Copy-Item [-LiteralPath] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Copy-Item [-Path] <string[]> [[-Destination] <string>] [-Container] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Copy-Item cmdlet copies an item from one location to another in a namespace. Copy-Item does not delete the items being copied. The particular items that the cmdlet can copy depend on the Windows PowerShell providers available. For example, when used with the FileSystem provider, it can copy files and directories and when used with the Registry provider, it can copy Registry keys and entries.

PARAMETERS
    -Container [<SwitchParameter>]
        Preserves container objects during the copy operation.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Destination <string>
        Specifies the path to the location where the items are to be copied.

        Required?                    false
        Position?                    2
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to copy items that cannot otherwise be changed, such as copying over a read-only file or Alias.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Specifies only those items upon which the cmdlet will act, excluding all others.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies a path to the item. The value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns an object representing each copied item. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the path to the items to copy.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Recurse [<SwitchParameter>]
        Specifies a recursive copy.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path to Copy-ItemProperty.

OUTPUTS
    None or an object representing the copied item.
        When you use the PassThru parameter, Copy-Item returns an object that represents the copied item. Otherwise, this cmdlet does not generate any output.

NOTES

        Copy-Item is like the ‘cp’ or ‘copy’ commands in other shells.

        The Copy-Item cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Copy-Item C:\Wabash\Logfiles\mar1604.log.txt -Destination C:\Presentation

    Description
    ———–
    This command will copy the file mar1604.log.txt to the C:\Presentation directory. The command does not delete the original file.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Copy-Item C:\Logfiles -Destination C:\Drawings -Recurse

    Description
    ———–
    This command copies the entire contents of the Logfiles directory into the Drawings directory. If the source directory contains files in subdirectories, those subdirectories will be copied with their file trees intact. The Container parameter is set to true by default. This preserves the directory structure.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Copy-Item C:\Logfiles -Destination C:\Drawings\Logs -Recurse

    Description
    ———–
    This command copies the contents of the C:\Logfiles directory to the C:\Drawings\Logs directory. It will create the subdirectory \Logs if it does not already exist.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113292
    about_providers
    Clear-Item
    Get-Item
    Invoke-Item
    Move-Item
    Set-Item
    New-Item
    Remove-Item
    Rename-Item

Clear-Item

NAME
    Clear-Item

SYNOPSIS
    Deletes the contents of an item, but does not delete the item.

SYNTAX
    Clear-Item [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Clear-Item [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Clear-Item cmdlet deletes the value of an item, but it does not delete the item. For example, Clear-Item can delete the value of a Variable, but it does not delete the Variable. The value that used to represent a cleared item is defined by each Windows PowerShell provider. Clear-Item is similar to Clear-Content, but it works on Aliases and Variables, instead of files.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to clear items that cannot otherwise be changed, such as read- only Aliases. The cmdlet cannot clear constants. Implementation varies from provider to provider. For more information, see about_providers. Even using the Force parameter, the cmdlet cannot override security restrictions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Clears only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the path to the items being cleared. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the path to the items being cleared. Wildcards are permitted. This parameter is required, but the parameter name (“Path”) is optional.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a path string to Clear-Item.

OUTPUTS
    None
        This cmdlet does not return any objects.

NOTES

        The Clear-Item cmdlet is supported only by several Windows PowerShell providers, including the Alias, Environment, Function, Registry, and Variable providers. As such, you can use Clear-Item to delete the content of items in the provider namespaces.

        You cannot use Clear-Item to delete the contents of a file, because the Windows PowerShell FileSystem provider does not support this cmdlet. To clear files, use Clear-Content.

        You can also refer to Clear-Item by its built-in Alias, “cli”. For more information, type “Get-Help about_aliases“.

        The Clear-Item cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Clear-Item Variable:TestVar1

    Description
    ———–
    This command deletes the value of the Variable, Testvar1. The Variable remains and is valid, but its value is set to null.

    The Variable name is prefixed with “Variable:” to indicate the Windows PowerShell Variable provider. To get the same result, you can switch to the Windows PowerShell Variable provider namespace first and then perform the Clear-Item command.

        PS C:> Set-Location Variable:
        PS Variable:\> Clear-Item Testvar1

    ————————– EXAMPLE 2 ————————–

    C:\PS>Clear-Item Alias:log* -Include *1* -Exclude *3* -WhatIf

    What if: Performing operation “Clear Item” on Target “Item: log1”.

    Description
    ———–
    This command asks Windows PowerShell what would happen if you executed the command, “Clear-Item Alias:log* -Include *1* -Exclude *3″. In response, Windows PowerShell explains that it would delete the value of the log1 Alias.

    This command would not have any effect on the log, log2, or log13 Aliases. Because the Alias provider does not permit an Alias without a value, when you clear an Alias, you also delete the Alias.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Clear-Item Registry::HKLM\Software\MyCompany\MyKey -Confirm

    Description
    ———–
    This command deletes all Registry entries in the MyKey subkey, but only after prompting you to confirm your intent. It does not delete the MyKey subkey or affect any other Registry keys or entries. You can use the Include and Exclude parameters to identify particular Registry keys, but you cannot use them to identify Registry entries. To delete particular Registry entries, use Remove-ItemProperty. To delete the value of a Registry entry, use Clear-ItemProperty.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113283
    about_providers
    Copy-Item
    Get-Item
    Invoke-Item
    Move-Item
    Set-Item
    New-Item
    Remove-Item
    Rename-Item

Clear-ItemProperty

NAME
    Clear-ItemProperty

SYNOPSIS
    Deletes the value of a property but does not delete the property.

SYNTAX
    Clear-ItemProperty [-LiteralPath] <string[]> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Clear-ItemProperty [-Path] <string[]> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Clear-ItemProperty cmdlet deletes the value of a property, but it does not delete the property. You can use this cmdlet to delete the data from a Registry value.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt” or “s*”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to delete properties from items that cannot otherwise be accessed by the user. Implementation varies from provider to provider. For more information, see about_providers.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Clears only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the path to the property being cleared. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Name <string>
        Specifies the name of the property to be cleared, such as the name of a Registry value. Wildcards are not permitted.

        Required?                    true
        Position?                    2
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns an object representing the cleared item’s property. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the path to the property being cleared. Wildcards are permitted.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a path string to Clear-ItemProperty.

OUTPUTS
    None or System.Management.Automation.PSCustomObject
        When you use the PassThru parameter, Clear-ItemProperty generates a PSCustomObject object that represents the cleared item property. Otherwise, this cmdlet does not generate any output.

NOTES

        You can use Clear-ItemProperty to delete the data in Registry values without deleting the value. If the data type of the value is Binary or DWORD, clearing the data sets the value to zero. Otherwise, the value is empty.

        You can also refer to Clear-ItemProperty by its built-in Alias, “clp”. For more information, see about_aliases.

        The Clear-ItemProperty cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Clear-Itemproperty -Path HKLM:\Software\MyCompany\MyApp -Name Options

    Description
    ———–
    This command deletes the data in the Options Registry value in the MyApp subkey of HKEY_LOCAL_MACHINE\Software\MyCompany.

    Because the command is being issued from a file system drive (C:), it uses the fully qualified path to the HKLM: drive and the Software\MyCompany\MyApp subkey. It uses the Name parameter to specify the Options value.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113284
    about_providers
    Copy-ItemProperty
    New-ItemProperty
    Move-ItemProperty
    Rename-ItemProperty
    Get-ItemProperty
    New-ItemProperty

Clear-Variable

NAME
    Clear-Variable

SYNOPSIS
    Deletes the value of a Variable.

SYNTAX
    Clear-Variable [-Name] <string[]> [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Scope <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

DESCRIPTION
    The Clear-Variable cmdlet deletes the data stored in a Variable, but it does not delete the Variable. As a result, the value of the Variable is NULL (empty). If the Variable has a specified data or object type, Clear-Variable preserves the type of the object stored in the Variable.

PARAMETERS
    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as “s*”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to clear a Variable even if it is read-only. Even using the Force parameter, the cmdlet cannot clear constants.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Clears only the specified items. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as “s*”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Name <string[]>
        Specifies the name of the Variable to be cleared. Wildcards are permitted. This parameter is required, but the parameter name (“Name”) is optional.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns an object representing the cleared Variable. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Scope <string>
        Specifies the scope in which this Alias is valid. Valid values are “Global”, “Local”, or “Script”, or a number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent). “Local” is the default. For more information, see about_scopes.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    None
        You cannot pipe objects to Clear-Variable.

OUTPUTS
    None or System.Management.Automation.PSVariable
        When you use the PassThru parameter, Clear-Variable generates a System.Management.Automation.PSVariable object representing the cleared Variable. Otherwise, this cmdlet does not generate any output.

NOTES

        To delete a Variable, along with its value, use Remove-Variable or Remove-Item.

        Clear-Variable will not delete the values of Variables that are set as constants or owned by the system, even if you use the -Force parameter.

        If the Variable that you are clearing does not exist, the cmdlet has no effect. It does not create a Variable with a null value.

        You can also refer to Clear-Variable by its built-in Alias, “clv”. For more information, see about_aliases.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Clear-Variable my* -global

    Description
    ———–
    This command deletes the value of the global Variables that begin with “my”.

    ————————– EXAMPLE 2 ————————–

    C:\PS>$a=3

    C:\PS>&{ Clear-Variable a }

    C:\PS>$a
    3

    Description
    ———–
    These commands demonstrate that clearing a Variable in a child scope does not clear the value in the parent scope. The first command sets the value of the Variable $a to “3”. The second command uses the invoke operator (&) to run a Clear-Variable command in a new scope. The Variable is cleared in the child scope (although it did not exist), but it is not cleared in the local scope. The third command, which gets the value of $a, shows that the value “3” is unaffected.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Clear-Variable -Name processes

    Description
    ———–
    This command deletes the value of the $processes Variable. The $processes Variable still exists, but the value is null.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113285
    Get-Variable
    Set-Variable
    New-Variable
    Remove-Variable

Clear-Content

NAME
    Clear-Content

SYNOPSIS
    Deletes the contents of an item, such as deleting the text from a file, but does not delete the item.

SYNTAX
    Clear-Content [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Clear-Content [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Clear-Content cmdlet deletes the contents of an item, such as deleting the text from a file, but it does not delete the item. As a result, the item exists, but it is empty. Clear-Content is similar to Clear-Item, but it works on files instead of on Aliases and Variables.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Allows the cmdlet to clear the file contents even if the file is read-only. Implementation varies from provider to provider. For more information, see about_providers. Even using the Force parameter, the cmdlet cannot override security restrictions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Clears only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the paths to the items from which content is deleted. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the paths to the items from which content is deleted. Wildcards are permitted. The paths must be paths to items, not to containers. For example, you must specify a path to one or more files, not a path to a directory. Wildcards are permitted. This parameter is required, but the parameter name (“Path”) is optional.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    None
        You cannot pipe objects to Clear-Content.

OUTPUTS
    None
        This cmdlet does not return any objects.

NOTES

        You can also refer to Clear-Content by its built-in Alias, “clc”. For more information, see about_aliases.

        If you omit the -Path parameter name, the value of Path must be the first parameter in the command. For example, “Clear-Content c:\mydir\*.txt”. If you include the parameter name, you can list the parameters in any order.

        You can use Clear-Content with the Windows PowerShell File System provider and with other providers that manipulate content. To clear items that are not considered to be content, such as items managed by the Windows PowerShell Certificate or Registry providers, use Clear-Item.

        The Clear-Content cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Clear-Content ..\SmpUsers\*\init.txt

    Description
    ———–
    This command deletes all of the content from the “init.txt” files in all subdirectories of the SmpUsers directory. The files are not deleted, but they are empty.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Clear-Content -Path * -Filter *.log -Force

    Description
    ———–
    This command deletes the contents of all files in the current directory with the “.log” file name extension, including files with the read-only attribute. The asterisk (*) in the path represents all items in the current directory. The Force parameter makes the command effective on read-only files. Using a filter to restrict the command to files with the “.log” file name extension instead of specifying “*.log” in the path makes the operation faster.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Clear-Content c:\Temp\* -Include Smp* -Exclude *2* -WhatIf

    Description
    ———–
    This command requests a prediction of what would happen if you submitted the command: “Clear-Content c:\temp\* -Include smp* -Exclude *2*”. The result lists the files that would be cleared; in this case, files in the Temp directory whose names begin with “Smp”, unless the file names include a “2”. To execute the command, run it again without the Whatif parameter.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113282
    about_providers
    Get-Content
    Set-Content
    Add-Content
    Get-Item

Add-Member

NAME
    Add-Member

SYNOPSIS
    Adds a user-defined custom member to an instance of a Windows PowerShell object.

SYNTAX
    Add-Member [-MemberType] {AliasProperty | CodeProperty | Property | NoteProperty | ScriptProperty | Properties | PropertySet | Method | CodeMethod | ScriptMethod | Methods | ParameterizedProperty | MemberSet | Event | All} [-Name] <string> -InputObject <psobject> [[-Value] <Object>] [[-SecondValue] <Object>] [-Force] [-PassThru] [<CommonParameters>]

DESCRIPTION
    The Add-Member cmdlet adds a user-defined custom member to an instance of a Windows PowerShell object. It lets you add the following types of members: AliasProperty, CodeProperty, NoteProperty, ScriptProperty, PropertySet, CodeMethod, MemberSet, and ScriptMethod. You set the initial value of the member by using the Value parameter. In the case of AliasProperty, ScriptProperty, CodeProperty, and CodeMethod, you can supply additional information by using the SecondValue parameter.

    The additional members are added to the particular instance of the object that you pipe to Add-Member or specify using the InputObject parameter. The additional member is available only while that instance exists. You can use the Export-Clixml cmdlet to save the instance, including the additional members, to a file. The information stored in that file can be used by the Import-Clixml cmdlet to re-create the instance of the object.

PARAMETERS
    -Force [<SwitchParameter>]
        Adds a new member even if one with the same name already exists. Does not work for core members of a type.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -InputObject <psobject>
        Specifies the object to which the new member is added. Enter a Variable that contains the objects, or type a command or expression that gets the objects.

        Required?                    true
        Position?                    named
        Default value
        Accept pipeline input?     true (ByValue)
        Accept wildcard characters? false

    -MemberType <PSMemberTypes>
        Specifies the type of the member to add. This parameter is mandatory.

        The valid values for this parameter are:
        — AliasProperty: A property that defines a new name for an existing property.
        — CodeMethod: A method that references a static method of a Microsoft .NET Framework class.
        — CodeProperty: A property that references a static property of a .NET Framework class.
        — MemberSet: A predefined collection of properties and methods, such as PSBase, PSObject, and PSTypeNames.
        — Method: A method of the underlying .NET Framework object.
        — NoteProperty: A property with a static value.
        — ParameterizedProperty: A property that takes parameters and parameter values.
        — Property: A property of the underlying .NET Framework object.
        — PropertySet: A predefined collection of object properties.
        — ScriptMethod: A method whose value is the output of a script.
        — ScriptProperty: A property whose value is the output of a script.

        — All: Gets all member types.
        — Methods: Gets all types of methods of the object (e.g. method, codemethod, scriptmethod)
        — Properties: Gets all types of properties of the object (e.g. property, codeproperty, Aliasproperty, scriptproperty).

        Not all objects have every type of member. If you specify a member type that the object does not have, Windows PowerShell returns an error.

        The Event member type is not valid for Add-Member.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? true

    -Name <string>
        Specifies the name of the member to be added.

        If you omit the “Name” parameter name, the value of the -Name parameter must be the second unnamed parameter value in the command. If you include the parameter name, the parameters can appear in any order.

        Required?                    true
        Position?                    2
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Passes the newly extended object to the pipeline. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -SecondValue <Object>
        Specifies optional additional information about AliasProperty, ScriptProperty, CodeProperty, or CodeMethod members. If used when adding an AliasProperty, this parameter must be a data type. A conversion (cast) to the specified data type is added to the value of the AliasProperty. For example, if you add an AliasProperty that provides an alternate name for a string property, you can also specify a SecondValue parameter of System.Int32 to indicate that the value of that string property should be converted to an integer when accessed by using the corresponding AliasProperty.

        You can use the SecondValue parameter to specify an additional ScriptBlock when adding a ScriptProperty member. In that case, the first ScriptBlock, specified in the Value parameter, is used to get the value of a Variable. The second ScriptBlock, specified in the SecondValue parameter, is used to set the value of a Variable.

        Required?                    false
        Position?                    4
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Value <Object>
        Specifies the initial value of the added member. If you add an AliasProperty, CodeProperty, or CodeMethod member, you can supply optional, additional information by using the SecondValue parameter.

        Required?                    false
        Position?                    3
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Management.Automation.PSObject
        You can pipe any object type to Add-Member.

OUTPUTS
    None or System.Object
        When you use the PassThru parameter, Add-Member returns the newly-extended object. Otherwise, this cmdlet does not generate any output.

NOTES

        You can add members only to PSObject objects. To determine if an object is a PSObject object, use the “is” operator. For example, to test an object stored in the $obj Variable, type “$obj -is [PSObject]”.

        The names of the MemberType, Name, Value, and SecondValue parameters are optional. If you omit the parameter names, the unnamed parameter values must appear in this order: MemberType, Name, Value, SecondValue. If you include the parameter names, the parameters can appear in any order

    ————————– EXAMPLE 1 ————————–

    C:\PS>$a = (Get-ChildItem)[0]

    C:\PS> $a | Add-Member -MemberType noteproperty -Name Status -Value done

    C:\PS> $a | Get-Member -type noteproperty

     TypeName: System.IO.DirectoryInfo

    Name         MemberType Definition
    —-         ———- ———-
    PSChildName NoteProperty System.String PSChildName=Co
    PSDrive     NoteProperty System.Management.Automation
    PSIsContainer NoteProperty System.Boolean PSIsContainer
    PSParentPath NoteProperty System.String PSParentPath=M
    PSPath        NoteProperty System.String PSPath=Microso
    PSProvider    NoteProperty System.Management.Automation
    Status        NoteProperty System.String Status=done

    Description
    ———–
    These commands add the Status note property to a DirectoryInfo object returned by Get-ChildItem and assigns it a value of “done”.

    The first command gets the first object that Get-ChildItem returns (index 0).

    The second command adds the note property.

    The third command uses a pipeline operator (|) to send the updated object to the Get-Member cmdlet. The output shows that the property has been added.

    ————————– EXAMPLE 2 ————————–

    C:\PS>$a = (Get-ChildItem)[0]

    C:\PS> $a | Add-Member -MemberType Aliasproperty -Name FileLength -Value Length

    C:\PS> $a.filelength

    Description
    ———–
    These commands add the FileLength Alias property to a DirectoryInfo object returned by Get-ChildItem. The new property is an Alias for the Length property.

    The first command gets the first object that Get-ChildItem returns (index 0).

    The second command adds the Alias property.

    The third command returns the value of the new FileLength property.

    ————————– EXAMPLE 3 ————————–

    C:\PS>$a = “a string”

    C:\PS> $a = $a | Add-Member -MemberType noteproperty -Name StringUse -Value Display -PassThru

    C:\PS> $a.StringUse

    Description
    ———–
    These commands add the StringUse a property to a string. Because the string is not a PSObject object, you must include the PassThru parameter in the command to save the extended string in the Variable. The last command in the example displays the new property.

    ————————– EXAMPLE 4 ————————–

    C:\PS>$a = “this is a string”

    C:\PS> $a = Add-Member -InputObject $a -MemberType scriptmethod -Name words `
    -Value {$this.split()} -PassThru

    C:\PS> $a.words()

    Description
    ———–
    These commands add a script method to a string object. The script method exposes the Split() method of the System.String .NET Framework Class Library class to make it convenient to return the individual words in a string by calling a method named “Words” on the string object. Note that the PassThru parameter is specified to force Add-Member to return the extended string object as output to be stored in the $a Variable.

    ————————– EXAMPLE 5 ————————–

    C:\PS>$event = Get-Eventlog -logname system -newest 1

    C:\PS> $event.TimeWritten | Get-Member

    C:\PS> Add-Member -InputObject $event -MemberType Aliasproperty -Name When `
    -Value TimeWritten -SecondValue System.String

    C:\PS> $event.When | Get-Member

    Description
    ———–
    These commands add an AliasProperty to an EventLogEntry object returned by the Get-EventLog cmdlets. The AliasProperty is named “When” and is an Alias for the TimeWritten property of the object. The SecondValue parameter is used to specify that the property value should be converted to type System.String when accessed by using the AliasProperty; the TimeWritten property is a DateTime object.

    The first command uses the Get-EventLog cmdlet to retrieve the most recent event from the System event log and stores it in the $event Variable.

    The second command accesses the TimeWritten property of that event and pipes it to the Get-Member cmdlet to demonstrate that the property is a DateTime type. Add-Member is then used to add an AliasProperty member to the instance of the EventLogEntry object stored in the $event Variable. The Name parameter is used to set the name of the new member to “When” and the Value parameter is used to specify that it is an Alias for the TimeWritten property. The SecondValue parameter is used to indicate that, when this new member is used, the value it returns should be cast from its original System.DateTime type to a System.String type.

    The third command accesses the new member and pipes it to the Get-Member cmdlet to confirm that it is of type System.String.

    ————————– EXAMPLE 6 ————————–

    C:\PS>function Copy-Property ($From, $To)

    {
     foreach ($p in Get-Member -InputObject $From -MemberType Property)
     {
         Add-Member -InputObject $To -MemberType NoteProperty -Name $p.Name
         -Value $From.$($p.Name) -Force

         $To.$($p.Name) = $From.$($p.Name)
     }
    }

    Description
    ———–
    This Function copies all of the properties of one object to another object.

    The first command in the Function declares the Function name and lists its parameters.

    The Foreach loop uses the Get-Member cmdlet to get each of the properties of the From object. The commands within the Foreach loop are performed in series on each of the properties.

    The Add-Member command adds the property of the From object to the To object as a NoteProperty. It uses the Force parameter to let the command add members with the same member name.

    The last command in the Function gives the new property the same name as the original property.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113280
    Get-Member
    Export-Clixml
    Import-Clixml

Add-Content

NAME
    Add-Content

SYNOPSIS
    Adds content to the specified items, such as adding words to a file.

SYNTAX
    Add-Content [-LiteralPath] <string[]> [-Value] <Object[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

    Add-Content [-Path] <string[]> [-Value] <Object[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Add-Content cmdlet appends content to a specified item or file. You can specify the content by typing the content in the command or by specifying an object that contains the content.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Force [<SwitchParameter>]
        Overrides the read-only attribute, allowing you to add content to a read-only file.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Adds only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the path to the items that receive the additional content. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -PassThru [<SwitchParameter>]
        Returns an object representing the added content. By default, this cmdlet does not generate any output.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the path to the items that receive the additional content. Wildcards are permitted. If you specify multiple paths, use commas to separate the paths.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Value <Object[]>
        Specifies the content to be added. Type a quoted string, such as “This data is for internal use only”, or specify an object that contains content, such as the DateTime object that Get-Date generates.

        You cannot specify the contents of a file by typing its path, because the path is just a string, but you can use a Get-Content command to get the content and pass it to the Value parameter.

        Required?                    true
        Position?                    2
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Confirm [<SwitchParameter>]
        Prompts you for confirmation before executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -WhatIf [<SwitchParameter>]
        Describes what would happen if you executed the command without actually executing the command.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        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 and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.Object
        You can pipe the objects to be added (the Value) to Add-Content.

OUTPUTS
    None or System.String
        When you use the Passthru parameter, Add-Content generates a System.String object representing the content. Otherwise, this cmdlet does not generate any output.

NOTES

        When you pipe an object to Add-Content, the object is converted to a string before it is added to the item. The object type determines the string format, but the format might be different than the default display of the object. To control the string format, use the formatting parameters of the sending cmdlet.

        You can also refer to Add-Content by its built-in Alias, “ac”. For more information, see about_aliases.

        The Add-Content cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Add-Content -Path *.txt -Exclude help* -Value “END”

    Description
    ———–
    This command adds “END” to all text files in the current directory, except for those with file names that begin with “help”.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Add-Content -Path file1.log, file2.log -Value (Get-Date) -PassThru

    Description
    ———–
    This command adds the date to the end of the File1.log and File2.log files and then displays the date at the command line. The command uses the Get-Date cmdlet to get the date, and it uses the Value parameter to pass the date to Add-Content. The PassThru parameter passes an object representing the added content through the pipeline. Because there is no other cmdlet to receive the passed object, it is displayed at the command line.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Add-Content -Path monthly.txt -Value (Get-Content c:\rec1\weekly.txt)

    Description
    ———–
    This command adds the contents of the Weekly.txt file to the end of the Monthly.txt file. It uses the Get-Content cmdlet to get the contents of the Weekly.txt file, and it uses the Value parameter to pass the content of weekly.txt to Add-Content. The parentheses ensure that the Get-Content command is complete before the Add-Content command begins.

    You can also copy the content of Weekly.txt to a Variable, such as $w, and then use the Value parameter to pass the Variable to Add-Content. In that case, the command would be “Add-Content -Path monthly.txt -Value $w”.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Add-Content -Value (Get-Content test.log) -Path C:\tests\test134\logs\test134.log

    Description
    ———–
    This command creates a new directory and file and copies the content of an existing file to the newly created file.

    This command uses the Add-Content cmdlet to add the content. The value of the Value parameter is a Get-Content command that gets content from an existing file, Test.log.

    The value of the path parameter is a path that does not exist when the command runs. In this example, only the C:\Tests directories exist. The command creates the remaining directories and the Test134.log file.

    The Force parameter is not required for this command. Add-Content creates directories to complete a path even without the Force parameter.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113278
    about_providers
    Get-Content
    Set-Content
    Clear-Content
    Get-Item