add the following to the end of your snippet...
-confirm:$false
like this:
set-networkadapter -networkname $ToNetwork -confirm:$false;
add the following to the end of your snippet...
-confirm:$false
like this:
set-networkadapter -networkname $ToNetwork -confirm:$false;