Highlighted
Expert
Expert

VMware.Vim.DVSSecurityPolicy

Jump to solution

After reading some articles on the site of luc (www.lucd.info)

I used some of his functions to create some dswitches.

For the creation of portgroups i wanted to change the security settings to disallow, promiscious mode, mac changes and forged transmits, like so:

$spec.defaultPortConfig.securityPolicy = New-Object VMware.Vim.DVSSecurityPolicy

$spec.defaultPortConfig.securityPolicy.allowPromiscuous = $false

$spec.defaultPortConfig.securityPolicy.forgedTransmits = $false

$spec.defaultPortConfig.securityPolicy.macChanges = $false

But for some reason this doesn't work, i get the following error:

Exception setting "MacChanges": "Cannot convert value "False" to type "VMware.V

im.BoolPolicy". Error: "Invalid cast from 'System.Boolean' to 'VMware.Vim.BoolP

olicy'.""

What am i doing wrong?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
VMware Employee
VMware Employee

Try this:

$spec.defaultPortConfig.securityPolicy.macChanges = New-Object VMware.Vim.BoolPolicy
$spec.defaultPortConfig.securityPolicy.macChanges.Value= $false

The same approach applies to allowPromiscuous and forgedTransmits properties.

Regards,

Yasen

Yasen Kalchev, vSM Dev Team

View solution in original post

0 Kudos
3 Replies
Highlighted
VMware Employee
VMware Employee

Try this:

$spec.defaultPortConfig.securityPolicy.macChanges = New-Object VMware.Vim.BoolPolicy
$spec.defaultPortConfig.securityPolicy.macChanges.Value= $false

The same approach applies to allowPromiscuous and forgedTransmits properties.

Regards,

Yasen

Yasen Kalchev, vSM Dev Team

View solution in original post

0 Kudos
Highlighted
Expert
Expert

Thanks.

It works now.

0 Kudos
Highlighted
Expert
Expert

Thanks.

It works now.

0 Kudos