Created
July 18, 2021 21:37
-
-
Save tknr/e802a38a4a1eaf5484fb6879f9fcc5f7 to your computer and use it in GitHub Desktop.
PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
exports installed packages. | |
.DESCRIPTION | |
exports installed packages: | |
exportChocolatey.ps1 > packages.config | |
You can install the packages using : | |
choco install packages.config -y | |
.LINK | |
https://gist.github.com/alimbada/449ddf65b4ef9752eff3 | |
#> | |
function exportChocolatey { | |
Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>" | |
Write-Output "<packages>" | |
choco list -lo -r -y | % { " <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" } | |
Write-Output "</packages>" | |
} | |
function ll { | |
Get-ChildItem $args[0] -force | Sort-Object -Property @{ Expression = 'LastWriteTime'; Descending = $true }, @{ Expression = 'Name'; Ascending = $true } | Format-Table -AutoSize -Property Mode, Length, LastWriteTime, Name | |
} | |
function getSchedules { | |
Get-ScheduledTask | Where {$_.State -eq 'Ready'} | Get-ScheduledTaskInfo | where {$_.nextruntime -ne $null} | select taskpath,taskname,nextruntime | |
} | |
function getFilenameDate { | |
Get-Date -UFormat "%Y%m%d%H%M" | |
} | |
function gitAddCommitPush { | |
git add --all && git commit && git push | |
} | |
function which { | |
Param( | |
[parameter(mandatory=$true)][String]$command | |
) | |
gcm $command | fl | |
} | |
function sudo { | |
powershell start-process pwsh -verb runas | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment