Last active
November 16, 2017 22:56
-
-
Save kalebo/869ad87e1ba8e284be3bf472ba1274dd to your computer and use it in GitHub Desktop.
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
# Make arrays for sets of machines so you don't have to remember the name | |
$S415_all = @( | |
"ESC-1C58BM1", | |
"ESC-CBX7JN1", | |
"ESC-2958BM1", | |
"ESC-B858BM1", | |
"ESC-5858BM1", | |
"ESC-6B58BM1", | |
"ESC-2C58BM1", | |
"ESC-F2BVLL1", | |
"ESC-F858BM1" | |
) | |
# Variables for each of the labs. Declaring them here will help reduce typos. | |
$ExampleLab = "\\ceres\labs\Physics 107 & 108" | |
$Payload = { | |
param($ShorcutFile, $TargetPath) | |
$AbsoluteShortcutFile = "$env:PUBLIC$ShorcutFile" | |
$wsshell = New-Object -ComObject WScript.Shell | |
$lnk = $wsshell.CreateShortcut($AbsoluteShortcutFile) | |
$lnk.WindowStyle = 1 | |
$lnk.TargetPath = "explorer.exe" | |
$lnk.Arguments = $TargetPath | |
$lnk.IconLocation = "explorer.exe,0" | |
$lnk.save() # This will overwrite the previous link if it existed | |
} | |
function PushLab($MachineList, $LabTarget) { | |
$Shortcut = "\Desktop\Arduino.lnk" # Incomplete because $env:PUBILC will be inserted and evaluated on remote target | |
Invoke-Command -ComputerName $MachineList -ScriptBlock $Payload -ArgumentList $Shortcut,$LabTarget | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment