Powershell SQL Server High Availability PrimaryReplicaServerName - inconsistent results
Whether you run that code while you are on the primary or secondary is irrelevant. When your path is SQLSERVER:\SQL\SERVERx\INSTANCE... you are technically running it against that server, it does not matter if you ran the command from the server or a random desktop in the domain.

The issue with it showing as secondary though is local. I do not get that on my servers. If, you had PowerShell and the provider opened on "Server1" when you failed it over then I would suggest opening a new PowerShell prompt and see if it shows the same thing. If it does then try from another computer all together.