Skip to content

Instantly share code, notes, and snippets.

View jmelosegui's full-sized avatar

Juan Manuel Elosegui jmelosegui

View GitHub Profile
$folderToDelete = "E:\d\"
takeown.exe /F $folderToDelete /R /A /D Y
icacls $folderToDelete /T /C /grant Administrators:F
Remove-Item $folderToDelete -Recurse -Force
@jmelosegui
jmelosegui / RunPowershellOnStartUp
Created August 17, 2020 13:12
This command creates a schedule task to run a powershell script on system startup.
schtasks /create /tn "Start Docker Containers" /sc onstart /delay 0000:30 /rl highest /ru system /tr "powershell.exe -file E:\ScheduledTasks\StartDockerContainers.ps1"

Keybase proof

I hereby claim:

  • I am jmelosegui on github.
  • I am jmelosegui (https://keybase.io/jmelosegui) on keybase.
  • I have a public key ASBPD3i2zMDoyI7xTA5byIbkSPge4cb6TyinON7-JTg3KAo

To claim this, I am signing this object:

Add-Type -AssemblyName System.Configuration
$fileMap = New-Object -TypeName System.Configuration.ExeConfigurationFileMap
$fileMap.ExeConfigFilename = "app.config"
$configurationUserLevelNone = 0
$config = [System.Configuration.ConfigurationManager]::OpenMappedExeConfiguration($fileMap, $configurationUserLevelNone)
$section = $config.GetSection("connectionStrings");
function Resolve-Error ($ErrorRecord=$Error[0])
{
$ErrorRecord | Format-List * -Force
$ErrorRecord.InvocationInfo | Format-List *
$Exception = $ErrorRecord.Exception
for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
{ "$i" * 80
$Exception | Format-List * -Force
}
}