Jump to content

Password Reset Script for Fortigates with VDOMs enabled


Red

Recommended Posts

Hi,

 

The default script "Reset Fortigate Password" to reset passwords on Fortigate firewalls will fail when virtual domains (VDOMs) are enabled on the device. This is due to the wrong starting environment when connected to the firewall. In this case, one can copy the existing powershell script and replace the lines

 

if ($PrivilegedAccountUserName -ne '') {
$ResetCommands = "config system admin`redit $UserName`rset password $NewPassword`rend`rexit`r"
}
else {
$ResetCommands = "config system admin`redit $UserName`rset password $NewPassword $OldPassword`rend`rexit`r"
}

 

with

if ($PrivilegedAccountUserName -ne '') {
$ResetCommands = "config global`rconfig system admin`redit $UserName`rset password $NewPassword`rend`rexit`r"
}
else {
$ResetCommands = "config global`rconfig system admin`redit $UserName`rset password $NewPassword $OldPassword`rend`rexit`r"
}

 

The new commands start with "config global" to change into the global context of the Fortigate. From that point onward, the commands are the same.

 

Regards,

Red

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...