SCharchouf's Posts

thanks there's no error now but both csv file are empty
I got the below error message:   Get-SecurityPolicy : Cannot validate argument on parameter 'VirtualSwitch'. The argument is null. Provide a valid value for the argument, and then try running the ... See more...
I got the below error message:   Get-SecurityPolicy : Cannot validate argument on parameter 'VirtualSwitch'. The argument is null. Provide a valid value for the argument, and then try running the command again. At X:\Test.ps1:576 char:39 + Get-SecurityPolicy -VirtualSwitch $switch -PipelineVariable polic ... + ~~~~~~~ + CategoryInfo : InvalidData: (:) [Get-SecurityPolicy], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetSecurityPolicy Get-SecurityPolicy : Cannot validate argument on parameter 'VirtualSwitch'. The argument is null. Provide a valid value for the argument, and then try running the command again. At X:\Test.ps1:576 char:39 + Get-SecurityPolicy -VirtualSwitch $switch -PipelineVariable polic ... + ~~~~~~~ + CategoryInfo : InvalidData: (:) [Get-SecurityPolicy], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetSecurityPolicy
it's Ok I got it In fact, the MTU of the physical port changes once the vmkernels are in a vDS
I'm using the below script to get Promiscuous Mode then I set it to desired value, I need assistance in order to create a script that can: First get Promiscuous Mode identify ESXi that have wrong ... See more...
I'm using the below script to get Promiscuous Mode then I set it to desired value, I need assistance in order to create a script that can: First get Promiscuous Mode identify ESXi that have wrong configuration set configuration to desired value $ESXs=get-vmhost $ESXs | % { $esx=$_ ; $switchs= Get-VirtualSwitch $esx $switchs | % { $switch=$_ ; $sec=Get-SecurityPolicy $switch ; ` "$esx $switch $($sec.AllowPromiscuous) $($sec.ForgedTransmits) $($sec.MacChanges)" >> $file_before} } $ESXs | Get-VirtualSwitch | Get-SecurityPolicy | Set-SecurityPolicy ` -MacChanges $false ` -ForgedTransmits $false ` -AllowPromiscuous $false $ESXs | % { $esx=$_ ; $switchs= Get-VirtualSwitch $esx $switchs | % { $switch=$_ ; $sec=Get-SecurityPolicy $switch ; ` "$esx $switch $($sec.AllowPromiscuous) $($sec.ForgedTransmits) $($sec.MacChanges)" >> $file_after } }
I'm trying to change the MTU on physicall ports because if it's noit set like vmkernel it create a lot of dropped packets
Thanks Luc but this is to change MTU on VMKernel and my question is related to physical vmnic ports shall I try something like this: $mtuSize = 9000 Get-VMHost | Get-VMHostNetworkAdapter -... See more...
Thanks Luc but this is to change MTU on VMKernel and my question is related to physical vmnic ports shall I try something like this: $mtuSize = 9000 Get-VMHost | Get-VMHostNetworkAdapter -Physical | Where-Object{$_.Mtu -ne $mtuSize} | Set-VMHostNetworkAdapter -Mtu $mtuSize -Confirm:$false >> can I get output for the vmnic into a file before change and got the config after change?
Basically I need to follow this recommendation from vSphere in order to be compliant Three types of VLAN tagging exist in vSphere: External Switch Tagging (EST) Virtual Switch Tagging (VS... See more...
Basically I need to follow this recommendation from vSphere in order to be compliant Three types of VLAN tagging exist in vSphere: External Switch Tagging (EST) Virtual Switch Tagging (VST) - The virtual switch tags with the configured VLAN ID the traffic that is incoming to the attached virtual machines and removes the VLAN tag from the traffic that is leaving them. To set up VST mode, assign a VLAN ID between 1 and 4095. Virtual Guest Tagging (VGT) - Virtual machines handle VLAN traffic. To activate VGT mode, set the VLAN ID to 4095. On a distributed switch, you can also allow virtual machine traffic based on its VLAN by using the VLAN Trunking option. so in that case I should compare to 0 and 1 I'm right?
As per vmware we shouldn't assign VLANids 0 or 1 except for network configuration for isolation and segmentation of virtual machine network traffic I'm getting VLanId like this 0 0-4094 and o... See more...
As per vmware we shouldn't assign VLANids 0 or 1 except for network configuration for isolation and segmentation of virtual machine network traffic I'm getting VLanId like this 0 0-4094 and other with unique number like 100 512 912....
Thanks LucD it's working, just one things, I would like to compare the data using a variable which should be different to 0 and 1 because: Reserved VLAN IDs: VLAN ID 0 (zero) Disables VLAN... See more...
Thanks LucD it's working, just one things, I would like to compare the data using a variable which should be different to 0 and 1 because: Reserved VLAN IDs: VLAN ID 0 (zero) Disables VLAN tagging on port group (EST Mode)   VLAN ID 4095 Enables trunking on port group (VGT Mode) Not able to do it :smileyblush: should be something like this if($vlan -eq '0' or -eq'1') do something
Thanks LucD, the idea is to ensure that the port group is not configured to use whatever value is set for the native VLAN. for that Ineed first to check and List all VDS and their Security Set... See more...
Thanks LucD, the idea is to ensure that the port group is not configured to use whatever value is set for the native VLAN. for that Ineed first to check and List all VDS and their Security Settings & VLANIds
Thanks LucD I replaced the Get-VirtualPort with Get-VDPortGroup and I got the below message Get-VDPortgroup : The input object cannot be bound to any parameters for the command either becau... See more...
Thanks LucD I replaced the Get-VirtualPort with Get-VDPortGroup and I got the below message Get-VDPortgroup : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
Hello I'm using the below script to get VDS Port Group it's working fine but I'm getting the warring message: WARNING: The output of the command produced distributed virtual portgroup objec... See more...
Hello I'm using the below script to get VDS Port Group it's working fine but I'm getting the warring message: WARNING: The output of the command produced distributed virtual portgroup objects. This behavior is obsolete and may change in the future. To retrieve distributed portgroups, use Get-VDPortgroup cmdlet in the VDS component. To retrieve standard portgroups, use -Standard. I would like to understand why I'm getting this warrning and how I car relidiate using the similar way used in my script? Get-VMHost -PipelineVariable ESX | Get-VirtualPortGroup | Select-Object @{N='VMHost';E={$esx.Name}},VirtualSwitch,Name,VlanId | Out-String | ForEach-Object { $_.Trim() } > ".\VDSportGroup.txt" #Verify if VlanID is set to 0 or 1, if so, then Check Get-VirtualPortGroup-Config.txt $CheckVlanID = (Get-Content .\VDSportGroup.txt | Format-Table VlanId | findstr /v " _$Null VlanId ----- _$Null") | where-object {$_ -like '*0*' -like '*1*'} | ForEach-Object{$_.split(".")[0]} function VDSPort{         if ($Null -eq $CheckVlanID) {             Write-Log -StartTab 1 -LinesBefore 1 -Level Success -Message "All Hosts have VlanID configured with value between 2 and 4094 " -FilePath $LogFile             }         else {             Write-Host -f red "Hosts with wrong VlanID detected"             Write-Log -StartTab 1 -LinesBefore 1 -Level Success -Message "Check Get-VirtualPortGroup-Config file for host(s) $CheckVlanID" -FilePath $LogFile             } } VDSPort
is there a way to change the MTU for physical NICs [vmnic] without downtime? The issue is that MTU 9000 was enabled on vmkernel and not enabled on physical ports which is not recommended and s... See more...
is there a way to change the MTU for physical NICs [vmnic] without downtime? The issue is that MTU 9000 was enabled on vmkernel and not enabled on physical ports which is not recommended and such kind of configuration impact performance and I'm able to identify a high % of dropped packets
thank you very much LucD , since I don't have enough experience in PowerCLI / PowerShell, so I make mistakes and my choices sometimes are not good to implement a solution. also knowing that... See more...
thank you very much LucD , since I don't have enough experience in PowerCLI / PowerShell, so I make mistakes and my choices sometimes are not good to implement a solution. also knowing that there is a multitude of options to implement a script and have the desired result, moreover since I am on this forum I see a clear improvement and this is due to your help and advice. Thank you again
I'm trying to create a script to disable ESXi shell, as I'm in the obligation to get the configuration before any change things I made the script like this #Collect configuration Get-VMHost ... See more...
I'm trying to create a script to disable ESXi shell, as I'm in the obligation to get the configuration before any change things I made the script like this #Collect configuration Get-VMHost | Get-VMHostService | Where { $_.key -eq "TSM" } | Select VMHost, Key, Label, Policy | Out-String | ForEach-Object { $_.Trim() } > ".\ESXiShell.txt" # Verification $CheckESXi_Shell_Disabled = (gc .\HardeningESXi-Logs\ESXi_Shell_Disabled-Config.txt | ft Value | findstr /v " _$Null Value ----- _$Null") | where-object {$_ -notlike '*off*'} | foreach{$_.split(".")[0]} function ESXiDisabled {     if ($CheckESXiDisabled -eq "off") {     Write-Log -Level Success -Message "All Hosts have ESXi shell disabled" -FilePath $LogFile     }     else {     Write-Host -f red "Host(s) with ESXi Shell not set as required "     Write-Log -Level Success -Message  "Fixing host(s)" -FilePath $LogFile     $CheckESXiDisabled | ForEach-Object {Get-VMHost | Get-VMHostService | Where { $_.key -eq "TSM"} | Set-VMHostService -Policy Off     } } } ESXiDisabled unfotunaly the script is not working as expected, if I change the policy from GUI I'm expecting that the script detect that and do change and if the policy is set to OFF script should say that and nothing is done
:smileygrin: :smileygrin: to be honest I'm new on this firm and I'm trying to correct things
:smileyblush::smileyblush: This is a vCenter for test but I just discovered right now that is not support any TLS Protocol so If have understood coorectly all TLS protocol mentionned by False m... See more...
:smileyblush::smileyblush: This is a vCenter for test but I just discovered right now that is not support any TLS Protocol so If have understood coorectly all TLS protocol mentionned by False means that no TLS supported is there any other things that you have identified from this output?
Here the result of the function TLSv1_0   : False KeyExhange : SSLv3     : False TLSv1_2   : False SSLv2     : False HashAlgorithm : Host      : vcenter.loca... See more...
Here the result of the function TLSv1_0   : False KeyExhange : SSLv3     : False TLSv1_2   : False SSLv2     : False HashAlgorithm : Host      : vcenter.local Port      : 443 TLSv1_1   : False From xxx.xxx.xxx.xxx to vcenter.local xxx.xxxx.xxx.xxx:443 CanRead: False CanSeek: False CanTimeout: True CanWrite: False CheckCertRevocationStatus: False CipherAlgorithm: CipherStrength: HashAlgorithm: HashStrength: IsAuthenticated: False IsEncrypted: False IsMutuallyAuthenticated: False IsServer: False IsSigned: False KeyExchangeAlgorithm: KeyExchangeStrength: LeaveInnerStreamOpen: False Length: LocalCertificate: Position: ReadTimeout: 15000 RemoteCertificate: SslProtocol: TransportContext: System.Net.SslStreamContext WriteTimeout: 15000
I solved the issue it's working fine Just I added the vcenter name without domain in the txt file and no error message received tested multiple Time and it's OK