Windows

Windows Management Tools

2022-02-16. Category & Tags: System, Windows, Management, Tools

Windows Task Scheduler (任务计划程序) # Examples: $action = New-ScheduledTaskAction -Execute 'pwsh.exe' -Argument '-NonInteractive -NoLogo -NoProfile -File "C:\MyScript.ps1"' $trigger = New-ScheduledTaskTrigger -Once -At 3am $settings = New-ScheduledTaskSettingsSet $task = New-ScheduledTask -Action $Action -Trigger $Trigger -Settings $Settings Register-ScheduledTask -TaskName 'MySchedule' -InputObject $task -User 'username' -Password 'passhere' ScheduledTask -TaskName 'MySchedule' $action = New-ScheduledTaskAction -Execute 'Powershell.exe' ` -Argument '-NoProfile -WindowStyle Hidden -command "& {get-eventlog -logname Application -After ((get-date).AddDays(-1)) | Export-Csv -Path c:\fso\applog.csv -Force -NoTypeInformation}"' $trigger = New-ScheduledTaskTrigger -Daily -At 0am Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "AppLog" -Description "Daily dump of Applog" $action = New-ScheduledTaskAction -Execute 'C:\FreeFileSync\FreeFileSync. ...

Find and Kill a Process

2021-10-09. Category & Tags: Windows, linux, Commands, Networking, Ports

see also: 鸟哥 Linux 私房菜 Basic Linux. Linux # find bound PID by port: fuser 8080/tcp kill by port: fuser -k 8080/tcp list by port: lsof -i:8080 using netstat: netstat -nlpte |grep :8080 or: ss -nlpt 'sport = :8080' ref 1 & ref 2 Windows # CMD find & kill by PID: netstat -ano | findstr :8080 tasklist | findstr "<the_PID>" taskkill /PID <the_PID> /F PS find for TCP & UDP: ...

Python GUI Frontend Options Comparison

2021-01-14. Category & Tags: Python, GUI, Desktop, Windows, linux, Cross-platfrom

Mainly for the (cross-platform) Python GUI frontend options. CEF (Chromium Embedded Framework). Pro: can use the same way of MVC thinking (modern html5); build-in chromium browser. Con: someone said it may need a little c++. PyQt (v5). Pro: big community, good doc (for c++). Con: c++ way of thinking, just the language is py (the official GUI tutorial lacks GUI screenshots!); pay for commercial usage; still often needs c++. Tkinter. Pro: build-in w/ py, big community. ...

Powershell PS In Case Of

2020-11-29. Category & Tags: Windows, Powershell, ssh, ps

See also SSH. Overview: for both server and client: enable remote manager on both sides; set the other side as trusted. On both: Enable-PSRemoting -SkipNetworkProfileCheck -Force Set-Item wsman:\localhost\Client\TrustedHosts -value 192.168.1.* On the client: Enter-PSSession 192.168.xx.xx -Credential <server_computername>\<username> Tip: $Env:COMPUTERNAME # for computername $Env:USERNAME # for username [ref]

Powershell In Case Of

2018-02-09. Category & Tags: Powershell, Windows

Use Microsoft Terminal # choco install -y microsoft-windows-terminal Customizing PS Prompt (Use ConEmu) # See more in [codeship]. install chocolatey (i.e. win pkg manager) # option 1 [chocolatey official]: # Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) # install choco choco install conemu -y # Install PowerShell modules Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Install-Module -Name 'posh-git' option 2, with Git together codeship: # # Set your PowerShell execution policy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force # Install Chocolatey iwr https://chocolatey. ...