/var/opt/nydus/ops/customer_local_ops/operating_system/powershell
NameSizeModeActions
add_user.ps121790644editdlrm
add_user_to_group.ps18930644editdlrm
change_password.ps116400644editdlrm
collect_packages.ps144750644editdlrm
collect_processes_services.ps17470644editdlrm
configure_port.ps115030644editdlrm
cpu_utilization.ps11410644editdlrm
enable_winexe.ps111960644editdlrm
extend_disk.ps120670644editdlrm
get_disk_info.ps155280644editdlrm
get_system_info.ps129770644editdlrm
install_devcon.ps133460644editdlrm
install_panopta.ps11880644editdlrm
install_qemu_agent.ps122850644editdlrm
memory_utilization.ps11800644editdlrm
reset_vm_properties.ps15200644editdlrm
setNetwork.ps130270644editdlrm
shutdown_ovh_vm.ps19580644editdlrm
update_invalid_resolvers.ps153700644editdlrm
Edit: /var/opt/nydus/ops/customer_local_ops/operating_system/powershell/setNetwork.ps1 (3027B)
Start-Transcript -Path C:\Windows\Temp\setNetwork.log -Append $endPointAddr=$Args $taskName="HostingNetworkInitialization" $taskScript="C:\Windows\Tasks\initializeHostingNetwork.ps1" $currentIps=Get-NetAdapter -Name Ethernet | Get-NetIPAddress -IPAddress "*" # Delete HostingNetworkInitialization script, then stop the task if(Test-Path $taskScript){Remove-Item $taskScript -Force} schtasks.exe /End /TN $taskName schtasks.exe /Query /TN $taskName /FO LIST /V #if only one ip configured if($endPointAddr.gettype() -eq 'String'){ $endPointAddr=@($endPointAddr) } #make sure we have the saved IPs in the IPs to set 'privateip.txt','publicip.txt' | %{ if(Test-Path "C:\Windows\Tasks\$($_)"){ $initialIp=Get-Content "C:\Windows\Tasks\$($_)" if($endPointAddr -notcontains $initialIp){ $endPointAddr+=@($initialIp) } } } "Start-Transcript -Path C:\Windows\Temp\initializeHostingNetwork.log" | Out-File $taskScript -encoding ASCII -append #compare and modify accordingly $ipSetCompare=Compare-Object $endPointAddr $($currentIps.IpAddress) -IncludeEqual $ipSetCompare | %{ $ipaddress=$($_.InputObject) if($_.SideIndicator -eq '<='){ "Adding $ipaddress" Get-NetAdapter -Name Ethernet | New-NetIPAddress -AddressFamily IPv4 -IPAddress $ipaddress -PrefixLength 32 -SkipAsSource $false "Set-NetIPAddress -IPAddress $ipaddress -SkipAsSource `$False" | Out-File $taskScript -encoding ASCII -append }elseif($_.SideIndicator -eq '=>'){ "Removing $ipaddress" Get-NetIPAddress -IPAddress $_.InputObject | Remove-NetIPAddress -Confirm:$false }else{ #IP not affected $ipObject = Get-NetAdapter -Name Ethernet | Get-NetIPAddress | ?{$_.ipaddress -eq $ipaddress} if($ipObject.PrefixLength -eq 32){ #if there is a public or addon IP, set this to outbound traffic "Set-NetIPAddress -IPAddress $ipaddress -SkipAsSource `$False" | Out-File $taskScript -encoding ASCII -append }else{ #count only ips that will remain if(($ipSetCompare | ?{$_.SideIndicator -ne '=>'}).count -lt 2){ #if there is only the private ip, set this to outbound traffic "Set-NetIPAddress -IPAddress $ipaddress -SkipAsSource `$False" | Out-File $taskScript -encoding ASCII -append }else{ #otherwise we do not want outbound traffic on the private ip "Set-NetIPAddress -IPAddress $ipaddress -SkipAsSource `$True" | Out-File $taskScript -encoding ASCII -append } } } } "Get-NetIPAddress -InterfaceAlias Ethernet" |Out-File $taskScript -encoding ASCII -append "Stop-Transcript" |Out-File $taskScript -encoding ASCII -append # Run the task script we just wrote powershell.exe -ExecutionPolicy Unrestricted -File $taskScript # Log end state for posterity "Final state:" Get-NetIPAddress -InterfaceAlias Ethernet Stop-Transcript