Use login credentials for elevated commands


How would i set up my dashboard to allow for the account i log into the dashboard with to be used automatically to run task that require elevation

So far ive been able to set up logging in with the elavated account and then storing the account credentials as cookies then when i run commands that require elevation then i use the -credentials switch and im able to pull the credentials from the cookies saved in browser

The issue with this method is ive only been able to get it to work on the elevated accounts password if the cookie is saved as plain text as when i try to save as secured string and use the credentials it doesnt work even after trying convertfrom-securestring on the password

Not sure im going bout this the right way any help would be appreciated.