Sida Loo Sameeyo Adeeg Daaqadaha
Mararka qaarkood waxaad u baahan tahay app ama qoraal si aad u sii wadato haddii aad gashay kombayutarkaaga iyo haddii kale. Waxaa laga yaabaa inay tahay qoraalka PowerShell si loola socdo dekedaha(PowerShell script to monitor ports) ama server-ka shabakada martigelinaya bogga shabakadaada guriga(web server hosting a page on your home network) .
Ujeedadu waxay tahay in haddii aad rabto in hab, script, ama barnaamij uu socdo ilaa inta uu kumbiyuutarku ku jiro, waxaad u baahan doontaa inaad abuurto Adeeg Windows ah(Windows Service) .
Maxaan u baahanahay si aan u sameeyo adeega Windows?(What Do I Need to Create a Windows Service?)
Si aad u abuurto adeegga Windows gudaha (Windows)Windows 10 , waxaa jira shuruudo dhowr ah:
- Gelitaanka maamulka(Administrator) ee kombiyuutarka
- Wax loo socodsiiyo adeeg ahaan ( PowerShell Script , barnaamij, iwm.)
- Maamulaha Adeegga(Service Manager) aan Nuugista ahayn ( NSSM ) ayaa la rakibay
Waa maxay Maamulaha Adeegga Aan Nuugista ahayn?(What Is the Non-Sucking Service Manager?)
Haa, ma tuuri kartid magac sidaas oo kale ah adigoon sharaxin. Hubaal in magacu yahay nasiib darro, haddana waa sax. Maamulaha Adeegga(Service Manager) aan Nuugista lahayn ( NSSM ) ayaa lagu doodi karaa inuu yahay habka ugu fudud ee lagu abuuri karo adeegga Windows kaas oo ah mid aad loogu kalsoon yahay oo la isku halayn karo. Waxaa dheer, waa bilaash iyo Open Source Software (OSS).
NSSM waxaa loo isticmaali karaa Windows Command Prompt , ama interface user garaaf ahaan ( GUI ). Taas macnaheedu waa qof kasta wuu isticmaali karaa. NSSM waxaa loo isticmaali karaa nooc kasta oo Windows ah oo dib ugu laabanaya, oo ay ku jiraan, Windows 2000 . Waxaa jira 32-bit iyo 64-bit(32-bit and 64-bit) versions. Haddii aad isticmaalayso kombiyuutar 64-bit ah, isku day noocaas marka hore. Haddii ay shaqayn waydo, dib ugu laabo nooca 32-bit.
Waxaad NSSM ka soo dejisan kartaa shabakada(download NSSM from the website) , NSSM ka xidhi kartaa Git(clone NSSM from Git) , ama ku rakib NSSM Chocolatey(install NSSM with Chocolatey) . Chocolatey waa maamulaha xirmada ee Windows(Chocolatey is a package manager for Windows) . Hababka rakibidda(Installation) way kala duwanaan doonaan iyadoo ku xidhan dariiqa aad marto. Fadlan(Please) la tasho tilmaamaha NSSM . Tusaale ahaan, waxaanu ka soo dejisanaynaa shabakada NSSM oo aanu ku rakibnay (NSSM)C:\WINDOWS\system32 .
Abuur Adeeg Daaqadaha leh NSSM(Create a Windows Service With NSSM)
Tusaalahan, waxaan ka abuuri doonaa adeeg ka baxsan qoraalka PowerShell(PowerShell script) si aan u galno celceliska culeyska CPU(CPU average load percentage) .
- Nuqul ka samee oo u keydi qoraalkan sidii log-CPULoadPercentage.ps1 meel aysan u badneyn inuu galo qof kale. Isku day inaad abuurto tusaha C:/Scripts oo ku kaydi halkaa. Sidoo kale, samee gal qoraallada(Scripts) ah oo la yiraahdo Logs . Ogsoonow in dariiqa qoraalku yahay C:/Scripts/log-CPULoadPercentage.ps1 . Waxaad u baahan doontaa taas hadhow.
Fiiro gaar(Note) ah: Dhammaan sadarrada hoose oo ay raacdo calaamadda # waa faallooyin oo ma saameynayso qoraalka.
CLS #Optional. I like to use this to clear the terminal when testing. #Make sure you have a folder called Logs in the same directory as this script #The log is where the records will be stored. Start-Transcript -Path "$PSScriptRoot\Logs\log-CPULoadPercentage-$(get-date -f yyyy-MM-dd).txt" -Append #While loop keeps it running until manually stopped While ($True){ #Creates a timestamp to know when the measurement was taken $timeStamp = get-date -f yyyy-MM-h:mm:ss #Gets the average load percentage at that time, then waits 5 seconds to do it again. $cpuLoadPercent = Get-CimInstance win32_processor | Measure-Object -Property LoadPercentage -Average | Select-Object Average;Start-Sleep -Seconds 5 #Isolates just the average so there isn't a weird @{Average=13} string $cpuLoadPercent = $cpuLoadPercent.Average #writes results to screen, or in this case to the log Write-Host "$timeStamp CPU Load Percentage $cpuLoadPercent" } Stop-Transcript
- Tan waxaa lagu samayn karaa midkood Windows Command Prompt ama PowerShell. U fur maamule ahaan(Open it as Administrator) .
- Geli amarka nssm ku rakib logCPUAvg(nssm install logCPUAvg) oo socodsii. Daaqadda rakibaha adeegga NSSM(NSSM service installer) ayaa furmi doonta.
- Guji(Click) badhanka ellipses ee ku xiga Jidka:(Path:) garoonka, u gudub powershell.exe(powershell.exe ) oo sida caadiga ah ku yaal C:\Windows\System32\ . Dooro powershell.exe Jidka :(Path:) iyo Hagaha bilowga:(Startup directory:) beeraha si toos ah ayaa loo buux dhaafin doonaa.
- Geli kuwa soo socda doodaha:(Arguments:) goobta: -ExecutionPolicy Bypass -NoProfile -File “C:\PathToScript\get-Script.ps1” , halkaas oo qaybta ugu dambeysa ay tahay dariiqa loo maro qoraalkaaga PowerShell iyo qoraalka magaca.
- Dooro tabka Faahfaahinta . (Details)Geli waxa aad rabto in adeega lagu muujiyo sida maamulaha Adeegyada (Services)Windows geli (Windows) magaca Muujinta:(Display name: ) goobta. Kadibna, gali waxa ay qabato ee Description: field. Nooca bilawga:(Startup type: ) waxaa loo dejin karaa si toos ah(Automatic) , Toos ah (Bilow dib u dhac ah)(Automatic (Delayed Start)) , Buug(Manual) , ama Naafo(Disabled) . Layligan, Toomaatig(Automatic) ayaa u wanaagsan.
- Dooro Log on tab. Dooro akoonkan :(This account) badhanka raadiyaha oo geli akoonka iyo erayga sirta ah ee adeeggu u shaqayn doono. Waxaad u baahan doontaa inaad doorato akoon uu adeeggu ku hoos socon doono. Fikrad ahaan, waxaad yeelan doontaa akoon Windows ah oo loo sameeyay kaliya in lagu socodsiiyo adeeggan. Oggolaanshaha akoonkan waa in lagu xaddidaa oo keliya waxa adeeggu u baahan yahay inuu sameeyo. Waxaad dooran kartaa koontada Nidaamka Maxaliga ah(Local System account) , laakiin laguma talinayo sababo ammaan dartood.
Waxaa jira dhowr tab oo kale oo loo isticmaali karo in lagu habeeyo adeegga. Layligan, qiimaha caadiga ah ee tabyadaas ayaa ku filan. Dooro badhanka adeegga ku rakib .(Install service )
- Marka adeegga la rakibo, waxaad arki doontaa Service “logCPUAvg” installed successfully! daaqada. Dooro OK si aad u xirto. Taasi waxay soo gabagabeyneysaa rakibidda.
- Fur Maareeyaha Adeegyada Windows(Windows Services Manager ) oo hubi in adeeggu jiro.
- Daar(Run) adeega si aad u hubiso in uu shaqaynayo.
- Si aad u xaqiijiso in adeegani socdo, isticmaal File Explorer si aad ugu socotid meesha logu talagalay in lagu kaydiyo si aad u aragto in uu jiro.
nssm-hubi-log.png(nssm-check-log.png)
Kasaarida Adeegga Daaqadaha ee NSSM(Removing a Windows Service With NSSM)
Waxaa laga yaabaa inaadan u baahnayn inaad la socoto culayska CPU gaaga(monitor your CPU) , markaa waxaad jeclaan lahayd inaad ka takhalusto adeegga. Nasiib wanaag, NSSM taas way fududahay.
- Gudaha Maamulaha Adeegyada Windows(Windows Services Manager) , jooji adeegga. Tan samee adiga oo dooranaya Log CPU Celceliska Load(Log CPU Average Load ) Service ka dib ama dooranaya badhanka joogsiga labajibbaaran ee aaladda ama Jooji xidhiidhka adeegga(Stop the service) ee dhinaca bidix.
- Fur midkood Windows Command Prompt ama PowerShell maamule ahaan.
- Geli amarka nssm ka saar logCPUAvg(nssm remove logCPUAvg) oo fuli amarka.
- NSSM waxay ku weydiin doontaa inaad xaqiijiso. Dooro Haa(Yes) .
- Marka adeegga la saaro, waxaad arki doontaa Service “logCPUAvg” removed successfully! Xaqiijinta. Dooro OK oo waad dhammaysay
Waa intaas. Waa fikrad wanaagsan in la hubiyo maamulaha adeegyada si loo hubiyo in adeeggu aanu meeshaas sii jirin. Haddii aad weli aragto adeegga, waxaa laga yaabaa inaad u baahato inaad dib u soo kiciso shaashadda oo waa inay tagto.
Adeegyadu waa hab fiican oo lagu socodsiiyo abka ama qoraallada u baahan inay mar walba shaqeeyaan, dib u bilaabaan naftooda haddii ay ku guuldareystaan, ama u baahan mudnaan ka duwan kan isticmaala hadda. Haddii aadan u baahnayn abkaaga ama qoraalkaaga si aad u samayso waxyaalahaas oo dhan, ka fiirso inaad isticmaasho Hawsha la qorsheeyay(using a Scheduled Task) .
Related posts
Sida loo awood ama u joojiyo Adeegga Caawinta IP gudaha Windows 10
Sida loo suurtageliyo Adeegga Macmiilka ee DNS haddii uu ku cirroodo Windows 10
Sida loo joojiyo Adeegga Gudaha ee Windows 10
Waa maxay Adeegga Bonjour ee Windows 10?
Hagaaji Cilada Ka Reebka Adeegga Nidaamka Gudaha Windows 10
Ku billow faylasha si fudud myLauncher for Windows 10 kombiyuutarada
Hagaaji Adeegga Intel RST Kuma Shaqeeyo Windows 10
Ku samee qoraalo fudud PeperNote ee Windows 10
Sida loo rakibo Profile Midabka gudaha Windows 10 adoo isticmaalaya Profile ICC
Qari ama ku tus badhanka goobta shaqada ee Windows ee shaqada gudaha Windows 10
Waa maxay Adeegga Waasmedic oo Ammaan ma yahay?
Ka yeel ka-hortagga-xumeynta gudaha Windows 10 Hello Wajiga Xaqiijinta
Sida loo Hagaajiyo Adeegga Cusbooneysiinta Windows Aan Socon
Samee Firefox ka samee kontaroolada warbaahinta ee Firefox Windows 10 Shaashada qufulka
Ashampoo WinOptimizer waa software bilaash ah si kor loogu qaado Windows 10
Waa maxay Ilaalinta socodka socodka ee Windows 10 - Sida loo damiyo ama loo damiyo
Sida loo furo .aspx files on Windows 10 computer
Sida loo Hagaajiyo Koodhka Joogsiga ee ka Reebka Adeegga Nidaamka gudaha Windows 10
Waa maxay Habka la Fulin karo Adeegga Antimalware & Ammaan ma yahay?
PicsArt waxa ay ku siisaa stickers Custom & Tafatirka 3D gaar ah Windows 10