Promised Example:
## Elevate to admin the current Script Execution If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { $arguments = "& '" + $myinvocation.mycommand.definition + "'" Start-Process powershell -Verb runAs -ArgumentList $arguments Break } ##Create credentials $password = ConvertTo-SecureString 'MySecretPassword' -AsPlainText -Force $user='useradmin' $credential = New-Object System.Management.Automation.PSCredential ($user, $password) ##Execute wusa.exe with parameters and useradmin credentials. Start-Process -FilePath <path wusa.exe> -ArgumentList <arguments for wusa.exe> -Credential $credential -LoadUserProfile -PassThruThis maybe works
With New-PSDrive you can mount samba and nfs shares if you have the nfs-infrastructure installed.