Posted in Linux Powershell

Powershell 7 pwsh7 na Linux Ubuntu 22 u konzoli ne reagira na Ctrl+lijevo i Ctrl+desno za skok riječ-po-riječ

Rješenje Set-PSReadLineKeyHandler -Chord "Ctrl+LeftArrow" -Function BackwardWord Set-PSReadLineKeyHandler -Chord "Ctrl+RightArrow" -Function NextWord pwsh7 powershell linux cursor left right jump word

Posted in Excel Firefox php Powershell SysAdmin Windows

windows, powershell – izlistaj sve upravljačke programe

powershell.ps1 Get-WmiObject Win32_PnPSignedDriver | select DeviceName, DeviceClass, Manufacturer, DriverVersion, DriverDate, InfName | Out-GridView   dism.exe dism.exe /online /get-drivers /format:table   Obriši driver pnputil.exe -d oem987.inf…

Posted in Android CLI CMD Powershell SysAdmin Windows

Kopiranje datoteke na / sa mobitela / tableta spojenog putem USB-a

Preduvjeti • ADB je instaliran na računalu https://www.xda-developers.com/install-adb-windows-macos-linux • mobitel/tablet je u načinu rada “USB debugging” = ON ○ Settings >> About phone >> Build…

Posted in Powershell

Powershell – Prikaži jednu vrijednost iz JSON datoteke

Struktura JSON datoteke “” > Settings > Common > Proxy > Server > Address (prvi entitet je prazan string) powershell.ps1 $jsonFilePath = "efs_cfg_dump" $jsonContent =…

Posted in Powershell Windows

Powershell pwsh7 intellisense autofill Windows Terminal

Zatvori sve powershellove, windows terminale, blabla i otvori pwsh kao Administrator. Install-Module PSReadLine -AllowPrerelease -Force Notepad $profile i dodaj na kraj: Import-Module PSReadLine Set-PSReadLineOption -PredictionSource…

Posted in CLI Powershell

Hyper-V – “Connect…” – Rezolucija je kao i Microsoft, još u 1970-ima

Set-VMVideo -VMName "UbuntuDesktop" -HorizontalResolution 1920 -VerticalResolution 1080 -ResolutionType Single hyperv hi, perv resolution connect xhyperv hi, perv xresolution xconnect

Posted in CLI Powershell

Powershell – Update-Help fuckery

Situacija update-help -UICulture en-US Problem Update-Help: Failed to update Help for the module(s) ‘AngleParse, Send-MailKitMessage’ with UI culture(s) {en-US} : The value of the HelpInfoUri…

Posted in Powershell

Powershell – ANSI kodovi

"$($PSStyle.Background.Blue)$($PSStyle.Foreground.White) Jednostavno $($PSStyle.Reset)" https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_ansi_terminals?view=powershell-7.3 powershell pwsh posh ansi codes colors reset terminal xpowershell xpwsh xposh xansi xcodes xcolors xreset xterminal

Posted in Powershell

Powershell – Nasumične poruke pogreške

I powershell, kao i mnogi drugi programi, trpi od neznanja i/ili lijenosti programera i/ili developera te lakomosti korporacije-proizvođača. Stoga ni oni nisu posvetili mnogo pozornosti…

Posted in CLI Powershell

Powershell – Prikaz brojeva

powershell.ps1 Provjeri svoju kulturnost: [System.Globalization.CultureInfo]::CurrentCulture. Za donje primjere ti treba “hr-HR“, a vjerujem da i ostale Balkanske prčije daju isti rezultat. Ta pogledajmo koliko razreda…

Posted in Powershell

Powershell – Debug/trace

powershell.ps1 Dodaj u skriptu ili CLI jedno od dva: Set-PSDebug -Trace 1 Set-PSDebug -Trace 2 Poništi s Set-PSDebug -Off https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/set-psdebug?view=powershell-7.3 pwsh posh powershell debug trace script…

Posted in CLI Powershell

Powershell – Komandnolinijski parametri – Elegantna verzija

powershell.ps1 Ako imaš parametre – okej, ako nemaš – traži da upišeš tamo gdje je “mandatory”. Važno: ovo moraju biti prve linije u skripti, na…

Posted in Powershell

Powershell – GUI input

$unos = [Microsoft.VisualBasic.Interaction]::InputBox("Opis šta se treba raditi blabla", "Naslov") hxxps://stackoverflow.com/questions/30534273/simple-inputbox-function  

Posted in Powershell

Powershell – CSV – Uzmi vrijednost određenog polja

podaci.csv Nema headera Jedan;111 Dva;222 Tri;333 poweshell.ps1 Učitaj $ceesve = Import-Csv "podaci.csv" -Delimiter ";" -Encoding "UTF8" -Header "Naziv","Vrijednost" Prikaži jedan podatak Write-Host ($ceesve | Where-Object…

Posted in Powershell Python

Varijabla – Je li “prazna”?

powershell.ps1 IF ($Varijabla.Length -eq 0) {Write-Host "Prazno"} python.py try: varijabla except: print("Prazno") varijabla xvarijabla prazna xprazna variable xvariable empty xempty check xcheck provjeri xprovjeri

Posted in Powershell

Powershell – Koji je dan u tjednu bio na dan yyyy-mm-gg

(Get-Date -Year 2022 -Month 01 -Day 01).DayOfWeek powershell xpowershell posh xposh pwsh xpwsh dayofweek xdayofweek danutjednu xdanutjednu dow xdow dut xdut find xfind calculate xcalculate

Posted in Excel Powershell

Powershell – Excel – Error OperationStopped 0x800A03EC 800A03EC x800A03EC

Koristiš Powershell ter umećeš fomulu u Excel datoteku. Kao i svaki normalan čovjek koji koristi HR postavke, delimiter ti je “;“. powershell.ps1 $plahtica.Cells.Item($row,$column).Formula = "=sum(A1;A2)"…

Posted in Excel Powershell

Powershell – Excel – Čitaj, piši, spremi – Primjeri

powershell.ps1 # OTVORI [threading.thread]::CurrentThread.CurrentCulture = ‘hr-HR’ $excelObject = New-Object -ComObject excel.application $excelFajl = $excelObject.Workbooks.Open("R:\ekselice\excel.xlsx") # moraš stavit full path $excelObject.Visible = $true # vidljivo, jelte,…

Posted in Excel Powershell

CSV2XLSX – Uvoz CSV datoteke u Excel

poweshell.ps1 Uvezi postojeću .CSV datoteku u postojeću .XLSX datoteku; dvije .CSV datoteke u jednu .XLSX; u dva različita “sheeta”; sačuvaj postojeći oblik shita. $CSVdatoteka1 =…

Posted in Bash CLI Linux Powershell SysAdmin Windows

WAN IP adresa

bash.sh curl –silent https://ipinfo.io/geo curl –silent https://am.i.mullvad.net/json powershell.ps1 (invoke-webrequest https://ipinfo.io/geo).content ipinfo xipinfo ajpi xajpi wan xwan ipaddress xipaddress address xaddress adresa xadresa