VMware Cloud Community
RobMokkink
Expert
Expert
Jump to solution

VMware.Vim.DVSSecurityPolicy

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?

Reply
0 Kudos
1 Solution

Accepted Solutions
ykalchev
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
3 Replies
ykalchev
VMware Employee
VMware Employee
Jump to solution

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
Reply
0 Kudos
RobMokkink
Expert
Expert
Jump to solution

Thanks.

It works now.

Reply
0 Kudos
RobMokkink
Expert
Expert
Jump to solution

Thanks.

It works now.

Reply
0 Kudos