PowerShell 7 Liiska Tilmaamaha Cusub

Nooca xiga ee weyn ee PowerShell wuu baxay, wuxuuna keenayaa xoogaa isbeddelo ah oo la taaban karo. Nooca toddobaad waxa ku jira astaamo ay ka mid yihiin fulinta is barbar socda, soo dejinta qaybo meel fog laga fuliyo, hawl-wadeenno cusub, iyo in ka badan. Maqaalkan, waxaan ku eegaynaa dhammaan sifooyinka cusub ee (New)PowerShell 7.0 .

PowerShell 7 Tilmaamaha

Isbeddellada Hagaha PowerShell

Markaad rakibto PowerShell 7(install PowerShell 7) , waxay ku rakibi doontaa hage cusub, oo ay la socoto PowerShell 5.1 . Haddii aad ka cusboonaysiinayso PowerShell Core 6.x , markaa waxay dib u qori doontaa tusaha PowerShell 6 , oo waxay ka saari doontaa dhammaan faylasha aan loo baahnayn. Waa kan liiska hagayaasha ay tahay inaad ogaato:

PowerShell 7 ayaa lagu rakibay si-

%programfiles%\PowerShell\7

Galka  %programfiles%\PowerShell\7 waxa lagu daraa $env:PATH

Xirmooyinka rakibayaasha PowerShell 7 waxay cusboonaysiiyaan noocyadii hore ee PowerShell Core 6.x :

PowerShell Core 6.x ee Windows:(PowerShell Core 6.x on Windows:)

%programfiles%\PowerShell\6

waxaa lagu bedelay 

%programfiles%\PowerShell\7

Linux:

/opt/microsoft/powershell/6

waxaa lagu bedelay 

/opt/microsoft/powershell/7

macOS: (macOS: )

/usr/local/microsoft/powershell/6

waxaa lagu bedelay

/usr/local/microsoft/powershell/7

Tilmaamo cusub oo ku jira PowerShell 7

Waxaan isku dayay inaan si kooban u sharaxo mid kasta oo ka mid ah sifooyinkan iyo sida ay u caawin doonto isticmaalayaasha (users)PowerShell . Si kastaba ha ahaatee, hubi inaad si faahfaahsan u akhrido bogga rasmiga ah ee Microsoft .

  1. Isbarbardhigga dhuumaha
  2. Hawl-wadeenno cusub
  3. ConciseView iyo Hel-Error(Get-Error) cmdlet
  4. Ogaysiisyada nooca cusub ee tooska ah
  5. (Invoke DSC)Si toos ah uga wac ilaha DSC PowerShell 7
  6. Lakabka waafaqid

Had iyo jeer hubi inaad hubiso Bedelka Deegaanka(Environment Variable) ka hor inta aanad tijaabin koodka dhabta ah.

1] Isbarbardhigga Dhuumaha

Hadda waxaad samayn kartaa ama u maarayn kartaa walxaha si isbarbar socda halkii aad ka isticmaali lahayd habka isku xigxiga marka aad isticmaalayso ForEach-Object -Parallel. Boostadayada ku saabsan uninstalling WIM , habkani wuxuu soo saari karaa saddex sawir oo WIM ah wax ka yar 10 ilbiriqsi halkii uu ka ahaan lahaa ku dhawaad ​​​​25 ilbiriqsi marka uu si isdaba joog ah u socdo. Halkan waxaa ah kood muunad ah:

Get-WindowsImage -Mounted | foreach -Parallel {Measure-Command {Dismount-WindowsImage -Discard -Path $_.Path}}

2] Hawl-wadeenno cusub

Waxa jira saddex hawlwadeen oo cusub— Ternary operator: a ? b : c, Pipeline chain operators: || and && and Null conditional operators: ?? and ??=.Kuwaani waxay u dhaqmaan sida hadal la fududeeyay haddii kale. (behaves like a simplified if-else statement.)Waxay fududeeyaan qoritaanka koodka halkii ay isticmaali lahaayeen loop-ka-kale mar walba.

3] ConciseView iyo Hel-Error cmdlet

Hel Amarka Cilada Ha PowerShell 7

ConciseView waa aragti la dooran karo adeegsadaha kaas oo karti loo siiyay sidii aragtida caadiga ah ee PowerShell 7 . Haddii qaladku aanu ka ahayn qoraalka, waxaad heli doontaa hal khad. Si kastaba ha ahaatee, haddii ay ka timid qoraalka ama uu jiro qalad kala saarid, waxaad heli doontaa fariin qalad ah oo badan, iyo tilmaame muujinaya xariiqa qaladku ka dhacay.

Markaa waxaad haysataa cmdlet Get-Error cusub kaas oo kaa caawin kara inaad aragti faahfaahsan ka hesho qaladka markaad rabto. Waxay soo bandhigi kartaa faahfaahin buuxda, oo ay ku jiraan ka-reebitaanka gudaha, ee khaladkii ugu dambeeyay ee dhacay.

$Error | Get-Error

Get-Error -Newest 3 # Displays the last three errors that occurred in the session

4 ](] Automatic) Ogaysiisyo nooca cusub oo toos ah

Laga bilaabo PowerShell 7 , nidaamku wuxuu hubin doonaa cusboonaysiinta hal mar maalintii wuxuuna ogeysiin doonaa nooc cusub haddii la heli karo. Macluumaadka waxa la tusay kaliya bilowga kalfadhiyada xiga. Waxaa jira saddex calan oo loo heli karo Cusbooneysiinta PowerShell(PowerShell Update)

  • Default GA, Horudhac iyo sii deynta RC
  • Demi(Off) Â waxay damisaa habka wargelinta ee cusboonaysiinta
  • LTS kaliya waxa ay ogaysiisaa wararka ku saabsan sii daynta adeega muddada-dheer ( LTS ) GA

Haddii aad rabto inaad damiso ogaysiisyada cusboonaysiinta ee PowerShell 7 , ku dhaqan amarkan daaqadda PowerShell .

$Env:POWERSHELL_UPDATECHECK = 'Off'

5] Si toos ah uga wac ilaha DSC (Invoke DSC)PowerShell 7

The Invoke-DscResource(Invoke-DscResource) cmdlet  waxa ay waddaa hab cayiman ee PowerShell Desired State Configuration ( DSC ). Waa muuqaal tijaabo ah.

Using this cmdlet, configuration management products can manage Windows or Linux by using DSC resources. This cmdlet also enables debugging of resources when the DSC engine is running with debugging enabled.

6] Lakabka waafaqid

Waxay u ogolaataa isticmaalayaasha PowerShell inay soo dejiyaan cutubyada fadhiga Windows PowerShell ee daahsoon. (Windows PowerShell)Isticmaalka tan, waxaad awood u yeelan doontaa inaad amarka dhabta ah ku qaadato kombiyuuterka fog oo aad ku celiso natiijooyinka fadhiga maxalliga ah. Hadda oo ay taageerto soo dejinta modules, waxaad ku socodsiin kartaa modules-yada kombiyuutarada fog.

PowerShell waa software il furan oo laga heli karo Linux iyo macOS sidoo kale. Aad ayey u fiican tahay in lagu arko astaamo badan oo cusub PowerShell 7 , waxaana rajeyneynaa inay sii kordheyso. Waxaad wax badan oo ku saabsan ka akhrisan kartaa Microsoft(about it on Microsoft) .



About the author

Waxaan ahay khabiir kombuyuutar, waxaanan ku takhasusay aaladaha iOS. Waxaan dadka caawinayay tan iyo 2009, waayo-aragnimadayda wax-soo-saarka Apple ayaa iga dhigaysa qofka ugu habboon ee ka caawinaya baahiyahooda tignoolajiyada. Xirfadeyda waxaa ka mid ah: - Dayactirka iyo cusboonaysiinta iPhones iyo iPod-yada -Rakida iyo isticmaalka software Apple - Ka caawinta dadka inay helaan apps-ka ugu fiican ee iPhones iyo iPod-yada - Ka shaqaynta mashaariicda onlaynka ah



Related posts