VMware Cloud Community
KobbySan
Contributor
Contributor

Is there a way to disable all unsigned module with one shot on all ESXi of the cluster ?

Hello guys,

Hope you doing great.

I want to disable all unsigned module on all ESXi of the cluster.

Do you how to do it ?

I tried this :

$ESXCli = Get-EsxCli -VMHost 'esxi1.toto.corp','esxi2.toto.corp'
$ESXCli.system.module.set($false, $false, "*.*")

 

But it seems, *.* or * doesn't work.

 

Thank you to you

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

You could do something like this

Get-VMHost -Name 'esxi1.toto.corp','esxi2.toto.corp' -PipelineVariable esx |
ForEach-Object -Process {
  $esxcli = Get-EsxCli -VMHost $esx -V2
  $esxcli.system.module.list.Invoke() |
  ForEach-Object -Process {
    $esxcli.system.module.get.Invoke(@{module="$($_.Name)"}) |
    Where-Object { $_.SignedStatus  -eq 'Unsigned'} | 
    ForEach-Object -Process {
      $esxcli.system.module.set.Invoke(@{module="$($_.Module)";enabled=$false})
    }
  }
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

KobbySan
Contributor
Contributor

Hi Luc,

 

Hope your are doing well.

Thank you for the fast reply.

 

I ran the block, and here the outcome :

 

true
true
true
true
true
true
Count not mmap module /usr/lib/vmware/vmkmod/.: No such device
At line:6 char:50
+ $esxcli.system.module.get.Invoke(@{module="$($_.Name)"}) |
+ ~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError

 

I'll rty my best to find out why the module did not show up.

 

Thank you a lot!

 

Kobby

Reply
0 Kudos
LucD
Leadership
Leadership

You could try with 

$esxcli.system.module.get.Invoke(@{module="xxxx"})

to check what might be special about that module.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

KobbySan
Contributor
Contributor

Wow thank you a lot Luc, it's useful !!

 

Have a good day 🙂

 

Kobby

Reply
0 Kudos