I have a work pc that is registered with an domain. My logon user don have any admin righs but when i'm prompted i have an .\xxxxx account i use to get admin rights.
I often change my IPv4 settings on the LAN card, Sometimes to a static adress and somtimes to DHCP. But every time i want to change the IP settings i need to enter my admin account.
is it posibel to do this with a Batch or powershell script? If it can remember my username and password in a secure way?
Ore can i get promted fore the admin password only once every day?
Yes, you can perform this action with PowerShell, however, securely storing an administrative login can be somewhat difficult when acting as a standard user. There are native methods where windows can store the administrative credentials, e.g. setting up the action as a scheduled task that you can initiate when required.
Another method is to remotely execute the function from a remote administrative server, as this would not require you to store administrative credentials locally.
Another way, (not recommended), is you can store the username/pass in a file, or include it directly within your script and run it when required.