Jump to content

Scripting help

TDP_Equinox

I'm trying to create a script that will download and run a file, then kill it once it's done. My goal is to update runtimes (java, flash, etc) in one swift shot. 
The issue i'm running into is any script I make (powershell) runs fine on the local system, but taking the script to any other machine throws "cannot be loaded because running scripts is disabled on this system.". 

I can run "set-executionpolicy unrestricted" on a given machine, but I need everything to be a one shot item; is there a solution for this?

This is what my script looks like

{
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{   
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
wget https://drive.google.com/uc?export=download"&"id=0B23KvKA052gSU0dJQ3Azd2dQblU -outFile C:\Users\Public\Downloads\updater.exe
start-sleep -Seconds 5
start C:\Users\Public\Downloads\updater.exe
start-sleep -seconds 15
Stop-Process -processname Ninite
}

 

Spoiler

I7 4790K @4.5 Ghz 1.294V

VALIDATION, MSI Z97 Gaming 7, 24GB DDR3 1600, Asus Strix 1070 8GB OC@ 2.2Ghz, Corsair graphite series 760T (Black), Cooler master V850, NH-D15 w/LNA ,1TB Samsung 850 Evo,  480GB Sandisk Ultra II SSD, 3TB Seagate Barracuda x 3, 1 TB WD Passport (Backup drive), 2 TB WD Passport (Backup Drive 2),  Windows 10 Pro x64 (uhg), Logitech G900 Chaos (Main), Steelseries Rival (FADE) (Courtesy of Edzel Yago, Thanks Ed), Steelsieres Rival 300 Hyperbeast Special Edition, Coolermaster Quickfire TKL (MX Blue), Razer Blackwidow Tournament edition (Greens).  Audio: Sennheiser HD598 SE, Edifier S1000DB, AudioEngine D1 DAC; Yamaha MG06X Mixer & AudioTechnica AT2020.

 

Phones; Daily drivers: Nexus 6P 64GB/iPhone 6 (Music), Apple Watch, Apple AirPods.

Laptop: 2015 Macbook Pro 13, 8GB of RAM, 2.7Ghz i5, 240GB Apple SSD. 

 

Spoiler

Plex Server: i7 3770, Gigabyte Board, 16GB DDR3 1600, Asus Strix GTX 1050ti 4GB, 120GB SSD Boot Drive, 8 x 3TB Seagate Barracuda, Rosewill RSV-R4000 With 2 Rosewill Hot Swap 4x Backplane Bays, 1050 Watt Corsair HX Series PSU,Hyper T2, Windows 10 Pro 

 

I also do Youtube, check me out!

Link to comment
Share on other sites

Link to post
Share on other sites

Two things...

1. Make sure there's not a group policy setting blocking scripts from being run.

2. Edit your post to remove formatting so night theme users can read your post without highlighting the text.

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
Share on other sites

Link to post
Share on other sites

18 hours ago, TheKDub said:

Two things...

1. Make sure there's not a group policy setting blocking scripts from being run.

2. Edit your post to remove formatting so night theme users can read your post without highlighting the text.

1. Running the script on any machine results in the same result, despite settings/group policy. 
2. I use night theme and can see it just fine, but I'll remove whatever formatting it had.

 

Spoiler

I7 4790K @4.5 Ghz 1.294V

VALIDATION, MSI Z97 Gaming 7, 24GB DDR3 1600, Asus Strix 1070 8GB OC@ 2.2Ghz, Corsair graphite series 760T (Black), Cooler master V850, NH-D15 w/LNA ,1TB Samsung 850 Evo,  480GB Sandisk Ultra II SSD, 3TB Seagate Barracuda x 3, 1 TB WD Passport (Backup drive), 2 TB WD Passport (Backup Drive 2),  Windows 10 Pro x64 (uhg), Logitech G900 Chaos (Main), Steelseries Rival (FADE) (Courtesy of Edzel Yago, Thanks Ed), Steelsieres Rival 300 Hyperbeast Special Edition, Coolermaster Quickfire TKL (MX Blue), Razer Blackwidow Tournament edition (Greens).  Audio: Sennheiser HD598 SE, Edifier S1000DB, AudioEngine D1 DAC; Yamaha MG06X Mixer & AudioTechnica AT2020.

 

Phones; Daily drivers: Nexus 6P 64GB/iPhone 6 (Music), Apple Watch, Apple AirPods.

Laptop: 2015 Macbook Pro 13, 8GB of RAM, 2.7Ghz i5, 240GB Apple SSD. 

 

Spoiler

Plex Server: i7 3770, Gigabyte Board, 16GB DDR3 1600, Asus Strix GTX 1050ti 4GB, 120GB SSD Boot Drive, 8 x 3TB Seagate Barracuda, Rosewill RSV-R4000 With 2 Rosewill Hot Swap 4x Backplane Bays, 1050 Watt Corsair HX Series PSU,Hyper T2, Windows 10 Pro 

 

I also do Youtube, check me out!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×