<#
Setup.ps1
Uninstalls* all versions of Arduino and installs latest
* Arduino is available as an .exe installer and a .zip archive
Script uses 7-Zip (installed on all of our machines) to unpack the zip version into the
desired destination directory, and then creates the necessary registry entries and
start menu shortcut. script does not attempt to uninstall .exe installs.
Sailer, Adam
2017.10.19
#>
## globals
$invoke = split-path -path $myInvocation.MyCommand.Path -parent
$os = gwmi win32_OperatingSystem
$proc = gwmi win32_Processor
$whatIf = $false
$product = 'Arduino'
$dest = $env:ProgramFiles
$key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
Function KillApps
{
write-host "`n`n@@ Called KillApps" -fore magenta
$array = get-process | ? { $_.Path -imatch 'arduino' }
$array; $array | stop-process -force
dir $env:Temp | remove-item -recurse -force -ea silentlyContinue
}
Function Uninstall
{
param(
[parameter(mandatory=$true)]
[string]$inp
)
write-host "`n`n@@ Called Uninstall" -for magenta
$paths = @(
$env:ProgramFiles
,${env:ProgramFiles(x86)}
,"$env:ProgramData\Start Menu\Programs"
,'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
,'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
) | ? { test-path $_ }
dir $paths | gp | ? { $_ -imatch $inp } | % {
$_.PSPath
$_.PSPath | remove-item -recurse -force -whatIf:$whatIf
}
}
Function Unpack
{
write-host "`n`n@@ Called Unpack" -fore magenta
dir $env:Temp | remove-item -recurse -force -ea silentlyContinue
$7z = get-item "$env:ProgramFiles\7-Zip\7z.exe" -ea silentlyContinue
if (!$7z) { exit 7 }
dir $invoke\setup -recurse -include ardu*.zip | % {
$options = "x -o`"$dest\$product`" `"$_`" -y"
write-host "Unpack : $_"
write-host $options -fore darkGray
if (!$whatIf) {
$process = start-process -filePath $7z -argumentList $options -wait -passThru
$process.ExitCode
$process.ExitCode | ? { $_ -ne 0 } | % { exit $_ }
}
}
}
Function Drivers
{
write-host "`n`n@@ Called Drivers" -for magenta
## certs seem to change with each new version released
$map = @{
'HKLM:\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates\AF124C200336F4248B03DEDCDA1AE51067f8DAF4' = [byte[]](0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0xaf,0x12,0x4c,0x20,0x03,0x36,0xf4,0x24,0x8b,0x03,0xde,0xdc,0xda,0x1a,0xe5,0x10,0x67,0xf8,0xda,0xf4,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xf0,0xa1,0x90,0x83,0xf9,0x55,0x10,0xd3,0x94,0x7b,0x82,0x39,0xc2,0x62,0xf6,0x1f,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xe7,0x37,0x39,0x46,0x1f,0x2b,0xd5,0xf5,0xb2,0x6d,0x23,0x41,0xd7,0x21,0x50,0x0c,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x6a,0xb4,0xe5,0xf6,0x04,0x6e,0x24,0x97,0xd7,0x6a,0x71,0x1c,0xfa,0x5a,0x24,0x49,0x52,0x66,0x9d,0x3c,0x0f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x88,0xab,0xf2,0xe7,0x5b,0x9b,0x97,0x84,0x4b,0x95,0xbf,0x00,0x55,0x85,0xfa,0x3e,0xe8,0x98,0xe8,0x16,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xd4,0x04,0x00,0x00,0x30,0x82,0x04,0xd0,0x30,0x82,0x03,0xb8,0xa0,0x03,0x02,0x01,0x02,0x02,0x12,0x11,0x21,0x63,0xd5,0xcf,0x47,0x2f,0x1f,0xe8,0x09,0x34,0x23,0x64,0xd5,0x26,0x10,0xae,0xcb,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x51,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x42,0x45,0x31,0x19,0x30,0x17,0x06,0x03,0x55,0x04,0x0a,0x13,0x10,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x53,0x69,0x67,0x6e,0x20,0x6e,0x76,0x2d,0x73,0x61,0x31,0x27,0x30,0x25,0x06,0x03,0x55,0x04,0x03,0x13,0x1e,0x47,0x6c,0x6f,0x62,0x61,0x6c,0x53,0x69,0x67,0x6e,0x20,0x43,0x6f,0x64,0x65,0x53,0x69,0x67,0x6e,0x69,0x6e,0x67,0x20,0x43,0x41,0x20,0x2d,0x20,0x47,0x32,0x30,0x1e,0x17,0x0d,0x31,0x33,0x31,0x32,0x31,0x32,0x31,0x34,0x32,0x35,0x33,0x31,0x5a,0x17,0x0d,0x31,0x37,0x30,0x31,0x31,0x38,0x31,0x39,0x34,0x36,0x33,0x35,0x5a,0x30,0x66,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x16,0x30,0x14,0x06,0x03,0x55,0x04,0x08,0x13,0x0d,0x4d,0x61,0x73,0x73,0x61,0x63,0x68,0x75,0x73,0x65,0x74,0x74,0x73,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x07,0x13,0x0a,0x53,0x6f,0x6d,0x65,0x72,0x76,0x69,0x6c,0x6c,0x65,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0a,0x13,0x0b,0x41,0x72,0x64,0x75,0x69,0x6e,0x6f,0x20,0x4c,0x4c,0x43,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x03,0x13,0x0b,0x41,0x72,0x64,0x75,0x69,0x6e,0x6f,0x20,0x4c,0x4c,0x43,0x30,0x82,0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01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f,0x8f,0xec,0xdf,0xe3,0x07,0xd0,0xac,0x8a,0xfa,0x57,0x55,0x99,0x9b,0x8e,0x96,0xc0,0x4d,0x0a,0xec,0xde,0x40,0x79,0x28,0x6e,0xb8,0x49,0x3b,0x7a,0x4f,0x5b,0x6a,0x67,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x8b,0x30,0x82,0x01,0x87,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x4c,0x06,0x03,0x55,0x1d,0x20,0x04,0x45,0x30,0x43,0x30,0x41,0x06,0x09,0x2b,0x06,0x01,0x04,0x01,0xa0,0x32,0x01,0x32,0x30,0x34,0x30,0x32,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,0x16,0x26,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x65,0x70,0x6f,0x73,0x69,0x74,0x6f,0x72,0x79,0x2f,0x30,0x09,0x06,0x03,0x55,0x1d,0x13,0x04,0x02,0x30,0x00,0x30,0x13,0x06,0x03,0x55,0x1d,0x25,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x3e,0x06,0x03,0x55,0x1d,0x1f,0x04,0x37,0x30,0x35,0x30,0x33,0xa0,0x31,0xa0,0x2f,0x86,0x2d,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x6c,0x2e,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x67,0x73,0x2f,0x67,0x73,0x63,0x6f,0x64,0x65,0x73,0x69,0x67,0x6e,0x67,0x32,0x2e,0x63,0x72,0x6c,0x30,0x81,0x86,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x7a,0x30,0x78,0x30,0x40,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x34,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x65,0x63,0x75,0x72,0x65,0x2e,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x63,0x61,0x63,0x65,0x72,0x74,0x2f,0x67,0x73,0x63,0x6f,0x64,0x65,0x73,0x69,0x67,0x6e,0x67,0x32,0x2e,0x63,0x72,0x74,0x30,0x34,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x28,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x32,0x2e,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x67,0x73,0x63,0x6f,0x64,0x65,0x73,0x69,0x67,0x6e,0x67,0x32,0x30,0x1d,0x06,0x03,0x55,0x1d,0x0e,0x04,0x16,0x04,0x14,0x6a,0xb4,0xe5,0xf6,0x04,0x6e,0x24,0x97,0xd7,0x6a,0x71,0x1c,0xfa,0x5a,0x24,0x49,0x52,0x66,0x9d,0x3c,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x08,0x6e,0xd8,0xb6,0x9c,0x8a,0xbf,0xed,0x3e,0xd7,0xc3,0x74,0x5d,0xcc,0x80,0x1f,0xa8,0x2f,0x50,0x7a,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x68,0x2a,0x99,0xf6,0x1f,0xc7,0xd1,0xf3,0xa6,0x13,0x70,0x50,0x26,0x6f,0xcc,0xce,0x25,0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x35,0x3a,0xb5,0xd9,0xdc,0xb8,0x76,0xff,0xd7,0xde,0x63,0x66,0xe1,0xc3,0xd4);
'HKLM:\SOFTWARE\Microsoft\SystemCertificates\TrustedPublisher\Certificates\5C9335752354DD34A44075B8D8079f8BE10AD210' = [byte[]](0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x5c,0x93,0x35,0x75,0x23,0x54,0xdd,0x34,0xa4,0x40,0x75,0xb8,0xd8,0x07,0x9f,0x8b,0xe1,0x0a,0xd2,0x10,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x85,0xb8,0x7f,0x5c,0x34,0x67,0x15,0xb7,0x84,0xf1,0x3c,0xd0,0x01,0x9d,0x09,0x97,0x19,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x9d,0x2b,0x2e,0x8f,0xe3,0x09,0xaf,0x4b,0xab,0x70,0xd4,0x23,0x93,0xf5,0x8e,0x1a,0x0f,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0xa9,0x37,0xac,0x73,0xbb,0xe5,0x07,0xdd,0xa1,0xdd,0x8c,0xbe,0xbe,0x78,0xe4,0xee,0x47,0xff,0x60,0x58,0x1c,0x09,0x9a,0x19,0xf4,0x91,0x9d,0x98,0x03,0xf8,0x02,0x2d,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xfa,0x04,0x00,0x00,0x30,0x82,0x04,0xf6,0x30,0x82,0x03,0xde,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,0x65,0x9f,0x0c,0x91,0xc3,0xd8,0x36,0x2b,0x08,0xb8,0x2a,0x85,0xdb,0x25,0xe1,0x9c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x30,0x7f,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x1d,0x30,0x1b,0x06,0x03,0x55,0x04,0x0a,0x13,0x14,0x53,0x79,0x6d,0x61,0x6e,0x74,0x65,0x63,0x20,0x43,0x6f,0x72,0x70,0x6f,0x72,0x61,0x74,0x69,0x6f,0x6e,0x31,0x1f,0x30,0x1d,0x06,0x03,0x55,0x04,0x0b,0x13,0x16,0x53,0x79,0x6d,0x61,0x6e,0x74,0x65,0x63,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4e,0x65,0x74,0x77,0x6f,0x72,0x6b,0x31,0x30,0x30,0x2e,0x06,0x03,0x55,0x04,0x03,0x13,0x27,0x53,0x79,0x6d,0x61,0x6e,0x74,0x65,0x63,0x20,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x53,0x48,0x41,0x32,0x35,0x36,0x20,0x43,0x6f,0x64,0x65,0x20,0x53,0x69,0x67,0x6e,0x69,0x6e,0x67,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x31,0x34,0x31,0x32,0x32,0x39,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x31,0x36,0x31,0x32,0x32,0x38,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x5e,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x49,0x54,0x31,0x0f,0x30,0x0d,0x06,0x03,0x55,0x04,0x08,0x13,0x06,0x54,0x6f,0x72,0x69,0x6e,0x6f,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x13,0x09,0x53,0x63,0x61,0x72,0x6d,0x61,0x67,0x6e,0x6f,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x0a,0x14,0x0b,0x41,0x72,0x64,0x75,0x69,0x6e,0x6f,0x20,0x73,0x72,0x6c,0x31,0x14,0x30,0x12,0x06,0x03,0x55,0x04,0x03,0x14,0x0b,0x41,0x72,0x64,0x75,0x69,0x6e,0x6f,0x20,0x73,0x72,0x6c,0x30,0x82,0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,0x00,0xb6,0x7c,0xec,0xf6,0xad,0xb0,0x72,0x01,0x42,0x78,0x31,0xee,0xb4,0x73,0x54,0x54,0x84,0xdc,0xf7,0x83,0x85,0x30,0xe9,0xa8,0xe7,0x5c,0xc5,0x29,0x85,0x7a,0x39,0xf6,0xe1,0xfb,0x56,0x89,0x33,0xed,0xe5,0xa4,0xb7,0x7b,0x08,0x96,0xda,0x17,0x5b,0x16,0x75,0x45,0x0e,0x9e,0xa8,0xb1,0x41,0x3a,0xb1,0xa8,0xcc,0xb9,0x86,0xf4,0x27,0x4b,0x01,0x85,0x9a,0x51,0x95,0x78,0xf2,0x11,0x22,0xa8,0x63,0x28,0xe3,0x23,0x6f,0xdd,0x7f,0x27,0x1c,0x01,0xa7,0x43,0x71,0x3b,0x0a,0x66,0x10,0x87,0x6d,0xf4,0x13,0xc1,0x65,0xac,0x82,0x11,0xfa,0xd6,0x19,0x8f,0x0b,0xdc,0x89,0xe0,0xad,0x0b,0x73,0xeb,0xfc,0x73,0x64,0xc8,0x65,0xb8,0x2a,0xae,0x50,0xfc,0xbe,0xef,0x08,0x5c,0x3f,0x43,0x26,0x1b,0x9f,0xbc,0xa7,0xb4,0x8a,0xed,0x05,0x7d,0x8d,0x82,0x3d,0xc3,0xd6,0x5a,0x28,0xa0,0xe6,0xb4,0x7b,0xad,0x5f,0x0e,0x3c,0x5b,0xd4,0x99,0x04,0xb9,0x06,0xd1,0xcb,0x8e,0xd7,0xb3,0x9f,0xf3,0xf7,0x53,0x15,0xed,0x91,0x50,0x6b,0x77,0x03,0x67,0x69,0xf5,0xf6,0x9b,0xf2,0x1d,0xbd,0x97,0xbd,0xf8,0xaa,0x86,0x30,0xaf,0x37,0xd5,0xd1,0x49,0xd9,0xe7,0x14,0x09,0xab,0x17,0x24,0xc3,0x95,0xf3,0x5e,0xb5,0xa9,0xc0,0xe5,0x48,0x6d,0xf1,0x91,0xec,0x32,0xfc,0x1a,0x2d,0x40,0xb1,0xa9,0xb1,0x04,0x80,0xb8,0x71,0x7a,0xa3,0x43,0x82,0x11,0x42,0xf5,0x02,0xe9,0x8d,0x9a,0x83,0x35,0x28,0xa8,0x70,0xab,0x8d,0x1a,0x91,0x8a,0x98,0xb0,0xb0,0x6e,0xb4,0x6f,0x2c,0xa3,0x2d,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x8d,0x30,0x82,0x01,0x89,0x30,0x09,0x06,0x03,0x55,0x1d,0x13,0x04,0x02,0x30,0x00,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x2b,0x06,0x03,0x55,0x1d,0x1f,0x04,0x24,0x30,0x22,0x30,0x20,0xa0,0x1e,0xa0,0x1c,0x86,0x1a,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x76,0x2e,0x73,0x79,0x6d,0x63,0x62,0x2e,0x63,0x6f,0x6d,0x2f,0x73,0x76,0x2e,0x63,0x72,0x6c,0x30,0x66,0x06,0x03,0x55,0x1d,0x20,0x04,0x5f,0x30,0x5d,0x30,0x5b,0x06,0x0b,0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x30,0x4c,0x30,0x23,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,0x16,0x17,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x64,0x2e,0x73,0x79,0x6d,0x63,0x62,0x2e,0x63,0x6f,0x6d,0x2f,0x63,0x70,0x73,0x30,0x25,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x02,0x30,0x19,0x0c,0x17,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x64,0x2e,0x73,0x79,0x6d,0x63,0x62,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,0x30,0x13,0x06,0x03,0x55,0x1d,0x25,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x57,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x4b,0x30,0x49,0x30,0x1f,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x13,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x76,0x2e,0x73,0x79,0x6d,0x63,0x64,0x2e,0x63,0x6f,0x6d,0x30,0x26,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x1a,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x76,0x2e,0x73,0x79,0x6d,0x63,0x62,0x2e,0x63,0x6f,0x6d,0x2f,0x73,0x76,0x2e,0x63,0x72,0x74,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,0x96,0x3b,0x53,0xf0,0x79,0x33,0x97,0xaf,0x7d,0x83,0xef,0x2e,0x2b,0xcc,0xca,0xb7,0x86,0x1e,0x72,0x66,0x30,0x1d,0x06,0x03,0x55,0x1d,0x0e,0x04,0x16,0x04,0x14,0xcf,0xde,0x46,0x9e,0x70,0x11,0x2a,0xe1,0x00,0x31,0x9c,0x1f,0x8f,0x25,0x1f,0x43,0xa5,0x5f,0xaf,0x34,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xf8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x04,0x10,0x30,0x16,0x06,0x0a,0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x1b,0x04,0x08,0x30,0x06,0x01,0x01,0x00,0x01,0x01,0xff,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x0b,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x80,0x7f,0xfa,0x1d,0x0a,0xd3,0x66,0x15,0x95,0xce,0xb5,0x52,0xcf,0x84,0x3f,0x96,0xde,0x13,0x44,0x47,0xba,0x60,0x47,0x8a,0xdd,0x94,0x51,0xa1,0x39,0xf7,0x97,0x7a,0x98,0x2c,0xa2,0xed,0x10,0x4d,0xed,0xbd,0x1f,0xbd,0x76,0xc3,0x62,0x79,0xa2,0x9e,0xb4,0x40,0x81,0x06,0x69,0x35,0xcb,0xbc,0x89,0xa7,0x39,0x60,0x54,0x0e,0x63,0x64,0xbd,0x8a,0xec,0xe5,0x5d,0x5f,0x45,0xdb,0xbe,0x82,0xbc,0x19,0x7e,0xac,0x38,0x33,0xfd,0x5a,0xba,0x5a,0x62,0xf8,0xa6,0x82,0x1f,0xb5,0x39,0xfd,0xd2,0xca,0x4f,0x5f,0x5a,0xce,0x5b,0x66,0x6b,0x32,0x44,0xc7,0x76,0x47,0xf4,0x06,0x0b,0x75,0xbe,0x65,0x1c,0x21,0xf5,0x5d,0xbd,0x05,0x0b,0xec,0xc2,0x1a,0x1e,0xc3,0xf8,0xb3,0xf6,0x78,0xb7,0x18,0xf7,0xfe,0xe5,0x09,0xb3,0x65,0x66,0xe9,0xeb,0x26,0x2d,0xcc,0x88,0x8a,0xd8,0xcb,0xaa,0x66,0x55,0x3c,0x7f,0xea,0xa5,0x8d,0xf7,0x90,0x4d,0x3f,0x16,0xce,0x75,0xcc,0xeb,0xd4,0x2a,0x20,0xad,0xac,0x28,0x9f,0x20,0xab,0x98,0x9f,0x54,0xbe,0x74,0x02,0x7f,0x2c,0x01,0x17,0x53,0x02,0x25,0x98,0x6d,0xe3,0x70,0xdc,0x5a,0xd7,0x4c,0xbb,0xb5,0xc3,0x6d,0x03,0xbb,0x9a,0xa0,0x9c,0xe6,0x82,0x3b,0x08,0x8a,0x03,0xc2,0xda,0xf6,0xd1,0x06,0x00,0x86,0x7c,0x93,0x19,0x3b,0xac,0xfd,0x0b,0xba,0xde,0xe1,0x59,0xf1,0x68,0xb7,0xf4,0x6a,0xb6,0x99,0x3f,0x20,0x7e,0xa1,0xc2,0xce,0xa8,0xe4,0x85,0xee,0xf6,0xee,0x00,0x76,0x27,0xc0,0x25,0x0a,0x19,0xed,0x4d,0x7a,0xf5);
}
$map.Keys | % { $key = $_; $value = $map.$_;
write-host "$key : $($value.Count) bytes" -fore cyan
new-item -path $key -ea silentlyContinue
new-itemProperty -path $key -name blob -propertyType binary -value $value -force -ea silentlyContinue
}
dir $dest\$product -recurse -include dpinst* | ? { $_ -imatch $arch } | % {
write-host $_.FullName -fore darkGray
write-host $_.Directory -fore darkGray
$process = start-process -filePath $_.FullName -argumentList "/q /lm /sw" -passThru
$process.ExitCode | ? { $_ -ne 0 } | % { write-host $_ }
}
$paths = @(
"$env:ProgramFiles\$product"
,"${env:ProgramFiles(x86)}\$product"
) | ? { test-path $_ }
dir $paths -recurse -include javaw.exe | % { $_; $app = $_.FullName
netsh advfirewall firewall delete rule name=$app
netsh advfirewall firewall delete rule name=$product
netsh advfirewall firewall add rule name=$product program=$app dir=in action=allow enable=yes
}
## drivers should now automatically install upon usb device plugin
}
Function Setup
{
write-host "`n`n@@ Called Setup" -for magenta
$path = "$env:ProgramData\Start Menu\Programs"
dir $dest\$product -recurse -include arduino.exe | % { $app = $_
## $app | select-object *
$version = $app.VersionInfo.FileVersion
write-host "$product`n$version`n" -fore cyan
$wshell = new-object -comObject wscript.shell
$link = $wshell.CreateShortcut("$path\$product.lnk")
$link.Description = $product
$link.TargetPath = $app.FullName
$link.IconLocation = $app
$link.WorkingDirectory = $app.Directory
if (!$whatIf) { $link.Save() }
#### registry entries
$item = "$key\$product"
new-item -path $key -name $product -force | out-null
$map = @{
DisplayIcon = $app;
DisplayName = $product;
DisplayVersion = $version;
Publisher = $product;
UninstallString = 'use powershell script';
}
$map.Keys | % { set-itemProperty -path $item -name $_ -value $map.$_ -force }
gp $item
}
}
Function CleanUp
{
write-host "`n`n@@ Called CleanUp" -fore magenta
$sh = new-object -comObject wscript.shell
dir $env:Public\Desktop -recurse -include *.lnk | ? { $sh.CreateShortcut($_).TargetPath -imatch 'arduino' } | remove-item -whatIf:$whatIf -verbose
}
#
#
Clear
KillApps
Uninstall 'arduino'
CleanUp
Unpack
Drivers
Setup
Comments