Vmware: Unterschied zwischen den Versionen

Aus SchnallIchNet
Wechseln zu: Navigation, Suche
(SCCM Tasks)
Zeile 67: Zeile 67:
  
 
  rm C:\ProgramData\winlogbeat\meta.json
 
  rm C:\ProgramData\winlogbeat\meta.json
 +
 +
 +
 +
== Snippets ==
 +
 +
=== Get connection state ===
 +
 +
<pre>
 +
get-vm | %{
 +
    $strVMName = $_.Name; Get-NetworkAdapter -VM $_ |
 +
        select @{n="VMName"; e={$strVMName}},Name,NetworkName,ConnectionState
 +
} | ?{$_.ConnectionState.StartConnected -eq $false}
 +
 +
VMName                  Name              NetworkName    ConnectionState
 +
------                  ----              -----------    ---------------
 +
51KOBDEV-V00017_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected
 +
51KOBDEV-V00027_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected
 +
51KOBDEV-V00016_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected
 +
</pre>
 +
 +
Set StartConnected:
 +
 +
<pre>
 +
get-vm | %{ Get-NetworkAdapter -VM $_ } | ?{$_.ConnectionState.StartConnected -eq $false} | Set-NetworkAdapter -StartConnected $true -confirm:$false
 +
</pre>
  
 
== ESXi upgrade ==
 
== ESXi upgrade ==

Version vom 18. Mai 2021, 08:03 Uhr


Clone System

1)	Shut down the VM
2)	Clone the VM
3)	Disconnect the NIC
4)	Bring up the VM
Win10)  Run uninstall.ps1 script below, to uninstall unprovisioned AppStore Apps
5)	Run sysprep /generalize
        cd %WINDIR%\system32\sysprep; ./sysprep /generalize
6)	Assign new workstation name / admin pw
7)      Run SCCM Tasks
8)      Run winlogbeat tasks
9)	Configure network / Connect NIC
10)     Join to domain

Uninstall.ps1

# Get the list of provisioned packages
$provisioned = Get-AppxProvisionedPackage -online

# Check each installed app
$count = 0

for ($i=1; $i -ile 2; $i++) {
  # Check each app (two loops just in case there are dependencies that can't be removed until the
  # main app is removed)
  Get-AppxPackage | ? {$_.SignatureKind -ne 'System'} | ForEach-Object {
    $current = $_
    $found = $provisioned | ? {$_.DisplayName -eq $current.Name -and $_.Version -eq $current.Version}
    if ($found.Count -eq 0)
    {
      Write-Host "$($current.Name) version $($current.Version) is not provisioned, removing."
      Remove-AppxPackage -Package $current.PackageFullName
      $count++
    }
  }
}

SCCM Tasks

$scriptblock = {
   net stop CCMEXEC
   del C:\Windows\SMSCFG.INI
   certutil -delstore SMS SMS
   C:\Windows\ccmsetup\ccmsetup.exe /uninstall
   C:\ITutils\Setup\ClientHealth\ccmsetup.exe SMSSITECODE=ARI DNSSUFFIX=Arifleet.com
}

And then:

foreach( $vm in (get-vm *dev-v0001*).name ) {
   echo "Trying $vm"
   Invoke-Command -ComputerName $vm -ScriptBlock $scriptblock
   echo ""
}

Winlogbeat Tasks

rm C:\ProgramData\winlogbeat\meta.json


Snippets

Get connection state

get-vm | %{
    $strVMName = $_.Name; Get-NetworkAdapter -VM $_ |
        select @{n="VMName"; e={$strVMName}},Name,NetworkName,ConnectionState
} | ?{$_.ConnectionState.StartConnected -eq $false}

VMName                  Name              NetworkName     ConnectionState
------                  ----              -----------     ---------------
51KOBDEV-V00017_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected
51KOBDEV-V00027_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected
51KOBDEV-V00016_replica Network adapter 1 10.219.106.0_24 Connected, GuestControl, NoStartConnected

Set StartConnected:

get-vm | %{ Get-NetworkAdapter -VM $_ } | ?{$_.ConnectionState.StartConnected -eq $false} | Set-NetworkAdapter -StartConnected $true -confirm:$false

ESXi upgrade

Get list of storage adapters

esxcli storage core adapter list

HBA Name  Driver      Link State  UID                                     Capabilities      
--------  ----------  ----------  --------------------------------------  ------------------
vmhba0    nhpsa       link-n/a    sas.50014380361bab70                                      
vmhba1    qlnativefc  link-up     fc.500143802318ab7b:500143802318ab7a    Data Integrity, Se
vmhba2    qlnativefc  link-up     fc.500143802318a82f:500143802318a82e    Data Integrity, Se
vmhba32   bnx2i       unbound     iscsi.vmhba32                           Second Level Lun I
vmhba33   bnx2i       unbound     iscsi.vmhba33                           Second Level Lun I
vmhba34   bnx2fc      link-down   fcoe.10003ca82a244d11:20003ca82a244d11  Second Level Lun I
vmhba35   bnx2fc      link-down   fcoe.10003ca82a244d15:20003ca82a244d15  Second Level Lun I

cat /proc/scsi/bnx2fc/7 | grep 'Host Device Name'
 Host Device Name vmhba34


Run this script in ESXi 6.x to obtain the driver version and Firmware for all HBAs in the system:

for name in `vmkchdev -l | grep vmhba | awk '{print$5}'`;do echo $name ; echo "VID :DID  SVID:SDID"; vmkchdev -l | grep $name | awk '{print $2 , $3}';printf "Driver: ";echo `esxcfg-scsidevs -a | grep $name |awk '{print $2}'`;vmkload_mod -s `esxcfg-scsidevs -a | grep $name|awk '{print $2}'` |grep -i version;echo `lspci -vvv | grep $name | awk '{print $1=$NF="",$0}'`;printf "\n";done


list interfaces

esxcli network ip interface list