Action Parameter to define IP Address

OK, so working through the how-to document, it’s not laid out in a very clear manner where exactly all of these individual parts tie together, but I did eventually successfully create and import the default parameterized fixlet from the following sections:

  • BES File Template
  • Bootstrap Section
  • Parameter Metadata Tag (Parameter)
  • Action Section

After importing, I made some fixlet description changes, exported again and modified the fields (for the last two sections) to my requirements for: Parameter Metadata Tag, Parameter Validator Tags, and the ActionScript (to write the inputted External IP Address to a registry key) as such:

(Note: the below code directly follows the “SANSID” entry if you are using the default template…)

	<MIMEField>
		<Name>ParameterMetadataTag</Name>
		<Value><![CDATA[{
			"IP_Address": {
			"Name": "IPAddress",
			"Title": "External IP Address:",
			"Description": "Enter the External IP address",
			"UIType": "Textbox",
			"CustomValidator" : "validateIP"
		}	
		}]]></Value>
	</MIMEField>
	
	<MIMEField>
		<Name>ParameterValidatorTag</Name>
		<Value><![CDATA[{
			validateIP:function(validationObj) {
				var currentValue=validationObj["currentValue"];
				if ( !currentValue.match(/^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})$/))
					return "The IP specified is invalid";
		}
		}]]></Value>
	</MIMEField>
	
	<MIMEField>
		<Name>x-fixlet-modification-time</Name>
		<Value>Tue, 19 Apr 2016 15:41:43 +0000</Value>
	</MIMEField>
	
	<Domain>BESC</Domain>
	
	<DefaultAction ID="Action1">
		<Description>
			<PreLink>Click </PreLink>
			<Link>here</Link>
			<PostLink> to deploy this action.</PostLink>
		</Description>		
		<ActionScript MIMEType="application/x-Fixlet-Windows-Shell">//
			if {x64 of operating system} 
			regset64 "[HKLM\Software\MyCompany\BigFix]" "External IP"="{parameter "IP_Address" of action}"
			else
			regset "[HKLM\Software\MyCompany\BigFix]" "External IP"="{parameter "IP_Address" of action}"
			endif
		</ActionScript>
	</DefaultAction>
</Fixlet>

I now have a lovely fixlet that requests user input in the IP address format, and kicks if anything other than integers 0-9 are used. It’s not sophisticated enough to lock down entry to only numbers <255, so that’ll be the next step.

Sean - thanks for your time!

1 Like