#DicaOCI - Erro ao adicionar segunda VNIC a um compute Windows

Após adicionar uma segunda VNIC a uma VM Windows na OCI, quando é executado o script secondary_vnic_windows_configure.ps1 tivemos o erro abaixo.
PS C:\Temp> .\secondary_vnic_windows_configure.ps1 "ocid1.vnic.oc1.sa-saopaulo-1.hhhhhhh"
.\secondary_vnic_windows_configure.ps1 : File C:\Temp\secondary_vnic_windows_configure.ps1 cannot be loaded. The file
C:\Temp\secondary_vnic_windows_configure.ps1 is not digitally signed. You cannot run this script on the current
system. For more information about running scripts and setting execution policy, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\secondary_vnic_windows_configure.ps1 "ocid1.vnic.oc1.sa-saopaulo-1. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Temp>
Para poder executar esse processo é preciso ignorar a política de segurança na atual execução do PowerShell. Vale ressaltar que esta liberação ocorre a nível de sessão, desta forma, assim que uma nova janela do PowerShell for aberta, ela utilizará a política de execução padrão.
PS C:\Temp> Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
PS C:\Temp>
Executado o comando a acima, basta executar o processo de adição da nova VNIC, conforme documentação.
PS C:\Temp>
PS C:\Temp> .\secondary_vnic_windows_configure.ps1 "ocid1.vnic.oc1.sa-saopaulo-1.hhhhhhhh"
+ Specified VNIC: ocid1.vnic.oc1.sa-saopaulo-1.hhhhhhhh

+ Found VNIC Settings:  {
    "vnicId":  "ocid1.vnic.oc1.sa-saopaulo-1.hhhhhhhh",
    "privateIp":  "10.1.1.2",
    "vlanTag":  351,
    "macAddr":  "02:00:17:00:E5:F7",
    "virtualRouterIp":  "10.1.1.1",
    "subnetCidrBlock":  "10.1.1.0/24"
}
+ Found Network Interface:  Ethernet 3

WARNING!
The Network Interface for the specified VNIC already has an IP Address. The current settings will be overwritten.
Proceed?
[Y] Yes  [N] No  [?] Help (default is "N"): Y

Confirm
Are you sure you want to perform this action?
Performing operation "Remove" on Target "NetIPAddress -IPv4Address xxxxxxxx-InterfaceIndex 24 -Store Active"
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A


IPAddress         : 10.1.1.2
InterfaceIndex    : 24
InterfaceAlias    : Ethernet 3
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Tentative
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

IPAddress         : 10.1.1.2
InterfaceIndex    : 24
InterfaceAlias    : Ethernet 3
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Invalid
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : PersistentStore

Assigned a static IP Address to the Network Interface.
Set the DNS server IP Address.
Created a default route for the Network Interface.
The Network Interface was successfully configured.


PS C:\Temp>
É possível validar que a VNIC foi adicionada com sucesso.
https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVNICs.htm
SHARE

Jhonata Lamim

  • Image
  • Image
  • Image
  • Image
  • Image

0 Comments:

Postar um comentário