I pasted a piece of code below but get an error seen here. It's part of an NTP time snippet that alerts when the offset exceeds a threshold but this is the piece that errors out. Please assist.
Unexpected attribute 'OutputType'.
+ Param (
Unexpected token 'Param' in expression or statement.
+ [String]$Server = "domain.com",
The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.
+ CategoryInfo : ParserError: (:) , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedAttribute
This is the code.
$api=New-Object -comObject "MOM.ScriptAPI"
$PropertyBag = $api.CreatePropertyBag()
Set-StrictMode -Version 3
[String]$Server = "Domain.com",
[Int]$MaxOffset = 1000, # (Milliseconds) Throw exception if network time offset is larger
[Switch]$NoDns # Do not attempt to lookup V3 secondary-server referenceIdentifier