Website under construction



Download 13,37 Mb.
Pdf ko'rish
bet118/131
Sana27.03.2022
Hajmi13,37 Mb.
#512480
1   ...   114   115   116   117   118   119   120   121   ...   131
Bog'liq
9780735697744 Introducing Windows Server 2016 pdf

More info To read more about creating custom types using Windows PowerShell, go to 
http://msdn.microsoft.com/powershell/wmf/5.0/class_overview

Windows PowerShell script debugging 
Windows Server 2016 introduced several improvements for script debugging introduced for Windows 
PowerShell: 

Break All 

Remote editing 

Remote debugging 

Job debugging 

Runspace debugging 

Remote Desired State Configuration debugging 
Let’s look into each element in more detail. 
Break All 
Break All is a very useful function to stop a script as it’s running so that we can dive into the debugger 
to find out how the script is running and what the current state of the variables and other elements 
are. Support has been included for both the Windows PowerShell console and the ISE. 
To use the debugger in a console session, press Ctrl+Break
In the Windows PowerShell ISE, you can press Ctrl+B or, on the menu, click Debug and then click 
Break All. 
Remote editing 
With the current Windows PowerShell ISE, you can open and directly edit a file in a remote Windows 
PowerShell session. Using a new command called PSEdit, we can directly edit files locally and in 
remote sessions. The following code shows a sample in action: 
[Cloud01]: PS C:\> PSEdit C:\WinDemo\Get-ComputerInfo.ps1 
When you execute PSEdit, it will open the file in the ISE where you can make changes and save them 
to the remote machine and reexecute the code. 
Remote debugging 
Extending on to the capabilities of remote editing, you can now debug a script running in a remote 
session with the ISE. 
The Set-PsBreakpoint cmdlet sets the breakpoint in the code and then you use the Write-Debug 
cmdlet to output some information for use in your scripts when you encounter a break point. This 
drops you into the debugger at that point to perform some additional work and look at the available 
information. Figure 5-1 shows this in operation. 


139 
CHAPTER 5 | Systems management 
Figure 5-1:
Sample code in the Windows Powershell ISE with remote debugging 
When a script encounters a breakpoint in a remote session, it will display a message indicating it has 
done so. Figure 5-2 illustrates a sample message. 
Figure 5-2:
Breakpoint warning in a remote session 
Not all remote sessions will support a remote debug session, but when you connect to the remote 
session using the Connect-PSSession cmdlet, you will see the output shown in Figure 5-3. The output 
also lets you know whether it is available. 
Figure 5-3:
Remote debug availability 
If remote debug is available, you can connect to the session by using the Enter-PSSession cmdlet
which connects you directly to the debugger 

Download 13,37 Mb.

Do'stlaringiz bilan baham:
1   ...   114   115   116   117   118   119   120   121   ...   131




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish