< Back

Invoke-ComputerMaintenance

Sat Jan 11, 2020 3:45 am

NAME Invoke-ComputerMaintenance



SYNOPSIS

The function executes all maintenance steps on a single host.





SYNTAX

Invoke-ComputerMaintenance [-ComputerName] <String> [[-PreventiveLockTimeout] <Int32>] [[-PreventiveLockThreshold]

<TimeSpan>] [-SkipNotLockable] [-SkipPreventivelyLocked] [<CommonParameters>]





DESCRIPTION

Use this function to perform maintenance on a single host, defined in the hosts configuration file. If you use an

orchestration/configuration management system, you might prefer it over Invoke-InfrastructureMaintenance to run

Invoke-ComputerMaintenance .





PARAMETERS

-ComputerName <String>

The name of a computer to process.



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PreventiveLockThreshold <TimeSpan>

Specifies how long the function will wait if a target host is locked by some other function.



Required? false

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PreventiveLockTimeout <Int32>

Specifies how often the function will request the lock status of a target host while waiting for it to unlock.



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SkipNotLockable [<SwitchParameter>]

Defines if the maintenance process should silently skip a host if the function cannot put a host lock on it.

Otherwise the function will raise an exception.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-SkipPreventivelyLocked [<SwitchParameter>]

Defines if the maintenance process should silently skip a host if it is locked by some other function.

Otherwise the function will raise an exception.



Required? false

Position? named

Default value False

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







OUTPUTS

System.Object







NOTES









-------------------------- Example 1 --------------------------



PS C:\\> Start-ComputerMaintenance -ComputerName 'SRV01'



Performs maintenance tasks on SRV01.

-------------------------- Example 2 --------------------------



PS C:\\> Start-ComputerMaintenance -ComputerName 'SRV01' -PreventiveLockThreshold (New-Object -TypeName

'System.TimeSpan' -ArgumentList @(2, 0, 0))



Performs maintenance tasks on SRV01. If the host will be locked, the function will wait for 2 hours for it to

unlock.



RELATED LINKS