I created the action script below which works when I put in an IP of ‘8.8.8.8’.
When I use {Parameter NAT} instead I get an error of constrained. How do I get this to use a parameter so I can apply to a bunch of servers without editing the fixlet?
action parameter query “NAT” with description “Please specify the server’s NAT IP address”
//1. Save old ExecutionPolicy value
parameter “PolicyExisted”="{exists value “ExecutionPolicy” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of (if exists x64 registry then x64 registry else registry)}“
parameter “oldExecutionPolicy”=”{if (parameter “PolicyExisted” as boolean) then (value “ExecutionPolicy” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of (if exists x64 registry then x64 registry else registry) as string) else “”}"
//2. set to ExecutionPolicy=Unrestricted and Pull PowerShell exe from registry… if 64bit then pull PowerShell x64
if {x64 of operating system}
regset64 “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” “ExecutionPolicy”=“Unrestricted"
parameter “PowerShellexe”=”{value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of x64 registry}"
else
//we need to determine what the current execution policy is so we can put it back when we’re done.
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” “ExecutionPolicy”=“Unrestricted"
parameter “PowerShellexe”=”{value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of registry}"
endif
//3. Create PowerShell Script and save to ps1 file
delete __createfile
delete smb.ps1
createfile until END_OF_FILE
$newValue = New-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters” -Name ‘SrvAllowedServerNames’ -PropertyType MultiString -Value (‘8.8.8.8’)
$newValue.multistring[0]
END_OF_FILE
move __createfile smb.ps1
action uses wow64 redirection false
waithidden “{parameter “PowerShellexe”}” -file “{pathname of client folder of current site}\smb.ps1”
//4. Restore ExecutionPolicy back
if {x64 of operating system}
if {parameter “PolicyExisted” as boolean}
regset64 “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” “ExecutionPolicy”="{parameter “oldExecutionPolicy”}"
else
regdelete64 “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” “ExecutionPolicy"
endif
else
if {parameter “PolicyExisted” as boolean}
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” “ExecutionPolicy”=”{parameter “oldExecutionPolicy”}"
else
regdelete “[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell]” "ExecutionPolicy"
endif
endif