diff options
author | sotech117 <michael_foiani@brown.edu> | 2025-08-22 16:23:10 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2025-08-22 16:23:10 -0400 |
commit | 19000561e610790395361bbb8123046f49301b1f (patch) | |
tree | 9e9e136fec89c998831a1eb7624707284508ba7e /new-tag.ps1 |
upload filesmaster
Diffstat (limited to 'new-tag.ps1')
-rw-r--r-- | new-tag.ps1 | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/new-tag.ps1 b/new-tag.ps1 new file mode 100644 index 0000000..8a9f235 --- /dev/null +++ b/new-tag.ps1 @@ -0,0 +1,97 @@ +echo "Download finished, starting file processing... (this step should take ~45 mins)"
+
+Unzip "$savePath/TAGNobel.zip" "$savePath/temp"
+
+Move-Item "$savePath/temp/TAGNobel" "$savePath/"
+Remove-Item "$savePath/temp"
+
+echo "Processing finished, moving to install processes...(this step should take ~45 mins)"
+
+#---START OF ORIGINAL SCRIPT---#
+
+$nobelFolderName = "NobelFolder"
+$downloadedLocation = Resolve-Path "~/Downloads/TAGNobel"
+$appFolder = "$downloadedLocation\App"
+$startupFolder = Resolve-Path "~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
+$downloadsNobelFolder = ("$downloadedLocation\$nobelFolderName")
+$documents = Resolve-Path "~/Documents"
+$nobelFolder = ("$documents\$nobelFolderName")
+
+POWERCFG -change -monitor-timeout-ac 0 #never sleep when plugged in
+POWERCFG -change -monitor-timeout-dc 0 #never sleep when NOT plugged in
+Disable-NetAdapter * �Confirm:$False #airplane mode
+
+if (Test-Path $nobelFolder) {Remove-Item $nobelFolder -recurse}
+Move-Item $downloadsNobelFolder $documents
+
+$path = "$downloadedLocation\keys_cmd.cmd"
+$xamppPath = "$downloadedLocation\xampp.exe"
+$fiddlerPath = "$downloadedLocation\fiddlersetup.exe"
+$loopbackPath = "$downloadedLocation\enableloopbackutility.exe"
+$certificatePath = "$appFolder\LADS_2.5.0.4_Test\LADS_2.5.0.4_AnyCPU.cer"
+
+$AllArgs = @('--mode','unattended')
+
+Start-Process $xamppPath $AllArgs -NoNewWindow -Wait
+
+$correctFolder = "$nobelFolder/" -replace "\\", "/"
+$confFile = "C:\xampp\apache\conf\httpd.conf"
+$autostartFile = "C:\xampp\xampp-control.ini"
+$validAutoStartFile = "$appFolder\xampp-control.ini"
+
+(Get-Content $confFile).replace('C:/xampp/htdocs', $correctFolder) | Set-Content $confFile
+(Get-Content $validAutoStartFile) | Set-Content $autostartFile
+
+$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
+$WUSettings.NotificationLevel=1
+$WUSettings.save() #never update
+
+Copy-Item "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\XAMPP\XAMPP Control Panel.lnk" "$startupFolder\"
+Copy-Item "$appFolder\restartScript.cmd" "$startupFolder\"
+Copy-Item "$appFolder\tagrunner.ps1" "C:\Users\"
+
+$pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2
+$pfx.import($certificatePath,"no password","Exportable,PersistKeySet")
+$store = new-object System.Security.Cryptography.X509Certificates.X509Store(
+ [System.Security.Cryptography.X509Certificates.StoreName]::Root,
+ "localmachine"
+)
+$store.open("MaxAllowed")
+$store.add($pfx)
+$store.close()
+
+Slmgr /ipk F27WN-R3TF9-RMG7F-P76TF-QGJYV
+Slmgr /ato ec67814b-30e6-4a50-bf7b-d55daf729d1e
+
+Import-Certificate -FilePath $certificatePath -CertStoreLocation 'Cert:\LocalMachine\My'
+Set-ExecutionPolicy Unrestricted
+REG ADD HKLM\SOFTWARE\Policies\Microsoft\Windows\Appx /v AllowAllTrustedApps /t REG_DWORD /d 1 -f
+REG ADD HKLM\SOFTWARE\Policies\Microsoft\Windows\Appx /v AllowDevelopmentWithoutDevLicense /t REG_DWORD /d 1 -f
+Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Appx" -Name "AllowAllTrustedApps" -Value 1
+Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Appx" -Name "AllowDevelopmentWithoutDevLicense" -Value 1
+Gpupdate
+
+import-module appx
+add-appxpackage "$appFolder\LADS_2.5.0.4_Test\LADS_2.5.0.4_AnyCPU.appxbundle"
+
+$quietFiddlerArgs = @('/S')
+
+Start-Process $fiddlerPath $quietFiddlerArgs -NoNewWindow -Wait
+Start-Process $loopbackPath $quietFiddlerArgs -NoNewWindow -Wait
+
+if (Test-Path "C:\Users\ADMIN") {"ADMIN Already Exists"}
+else{Start-Process "$appFolder\create_admin.cmd" $AllArgs -NoNewWindow -Wait }
+
+Start-Process "C:\xampp\xampp_start.exe" $AllArgs -NoNewWindow
+
+$desktop = Resolve-Path "~/Desktop"
+New-Item "$desktop/set_application.ps1" -type file -force
+
+$content = "`$startupFile = Resolve-Path `"~/Documents/NobelFolder/AUTO_START_DO_NOT_DELETE.txt`"
+`$contents = `"`"
+while((`$contents -ne `"l`") -and (`$contents -ne `"w`")){`$contents = Read-Host -Prompt `"type 'w' for the Will or 'l' for the Laureates`"}
+`$toWrite = 'laureates'
+if(`$contents -eq 'w'){`$toWrite = `"will`"}
+[system.io.file]::WriteAllText(`$startupFile,`$toWrite)"
+
+$content | Set-Content "$desktop/set_application.ps1"
\ No newline at end of file |