LAN segmentlari uchun PowerShell funksiyasi
VMware LAN segmenti maʼlumotlarini olish zerikarli vazifa, shuning uchun jarayonni soddalashtirish uchun PowerShell funksiyasini yaratdim. Kod bu yerda mavjud .
1. PSModulePath muhit oʻzgaruvchisi qiymati oʻrnatilganligini tekshiring.
PS C:\> $env:PSModulePath.Split(';')
C:\Users\marc\ Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C: \ Windows \ system32 \ WindowsPowerShell \ v1.0 \ Modules
2. Modullar katalogini yarating (agar kerak bo'lsa).
PS C:\> Test-Path -Path $env:PSModulePath.Split(';')[0] -PathType Konteyner
False
PS C:\> mkdir $env:PSModulePath.Split(';')[0]
3. PowerShell modul paketini GitHub’dan yuklab oling.
PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\> $Url = "https://github.com/mweisel/GetVMwareLANSegment/archive/master.zip"
PS C:\> $Zipfile = "$HOME\Downloads\GetVMwareLANSegment.zip"
PS C:\> (New-Object System.Net.WebClient).DownloadFile($Url, $Zipfile)
4. Tarkibni Modules katalogiga oching.
PS C:\> Expand-Arxive -Path $Zipfile -Dest $env:PSModulePath.Split(';')[0] -Majburlash
5. Katalog nomini o'zgartiring.
PS C:\> Move-Item $HOME\Documents\WindowsPowerShell\Modules\GetVMwareLANSegment-master $HOME\Documents\WindowsPowerShell\Modules\GetVMwareLANSegment
6. PowerShell buyrug'ini ishga tushiring.
PS C:\> Get-VMwareLANSegment
Ism identifikatori
---- --
link001 52 00 8d cc 3f f0 d0 55 - e6 c7 2a 7a 3d 1b e5 77
link002 52 ce b6 d5 e6 88 91 15-fe a3 0f b3 06 11 4a 1d
brdg001 52 97 4c 08 53 40 8b 69-4f b0 c8 8f 10 95 6c d7
brdg002 52 32 d1 9a c2 47 76 5a-ff 11 ea 7d 4d 5c d5 91
7. PowerShell buyrug'i uchun yordamni ko'rsatish.
PS C:\> yordam Get-VMwareLANSegment -Full
VMware Workstation virtual mashinasida Internetni sozlash
Server rollari, xizmatlari va xususiyatlari tushunchalari
Serverni domen administratorlari foydalanuvchilarini yarating.
Do'stlaringiz bilan baham: |