i try to use following to set static IP settings but getting the error. I have UAC turnd off. I trid using local administrator
The request operation requires elevation (run as administrator)
Function Set-WinVMIP {
param(
[string]$VM,
[string]$IP,
[string]$SNM,
[string]$GW,
[string]$DNS1,
[string]$DNS2
)
$cmd = @"
netsh interface ip set address "Ethernet0" static $IP $SNM $GW 1"
netsh interface ip add dns name="Ethernet0" source=static addr=$DNS1 register=primary
netsh interface ip add dns name="Ethernet0" source=static addr=$DNS2 index=2
"@
$xxx = get-credential
Invoke-vmscript -scripttext ($ExecutionContext.InvokeCommand.ExpandString($cmd)) -scriptType bat -VM $VM -guestcredential $xxxx
}
any idea
Bypassing UAC borders on hacking, so no game in this community I'm afraid.
See a similar discussion in Bypass UAC with invoke-vmscript - VMware Technology Network VMTN
There are apparently some ways to bypass UAC, but again that is hacking.
Try Googling UAC, scheduled task, and schtasks, you might find some tips
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Bypassing UAC borders on hacking, so no game in this community I'm afraid.
See a similar discussion in Bypass UAC with invoke-vmscript - VMware Technology Network VMTN
There are apparently some ways to bypass UAC, but again that is hacking.
Try Googling UAC, scheduled task, and schtasks, you might find some tips
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok thanks Luc