41 lines
933 B
PowerShell
41 lines
933 B
PowerShell
# This script eases network registration and update through a simple menu system
|
|
# Ben Hatto 2026
|
|
|
|
# SSH details
|
|
$remoteHost = "chavez"
|
|
$keyPath = "$HOME\.ssh\id_rsa"
|
|
|
|
# Grab netid for SSH later
|
|
function Grab-NetID {
|
|
Write-Host "Welcome to Easy Reg Update!"
|
|
$user = Read-Host -Prompt "Please enter your EGR NetID"
|
|
}
|
|
|
|
function Send-Command {
|
|
param (
|
|
[string]$Command
|
|
)
|
|
#connect to chavez and load the profile
|
|
ssh -i $keyPath ${user}@${remoteHost} "source ~/.bashrc && $Command && exit"
|
|
}
|
|
|
|
#ssh to chavez with
|
|
function Check-Registration {
|
|
"nb-search.pl --email hattoben@egr.msu.edu"
|
|
}
|
|
|
|
# Prompt user with menu
|
|
function Show-Menu {
|
|
Write-Host "What would you like to do?"
|
|
Write-Host "1) Check Registration `n2) Update Registration"
|
|
$choice = Read-Host -Prompt "Enter your selection:"
|
|
|
|
switch($choice) {
|
|
'1' {
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
Grab-NetID
|
|
Send-Command -Command "echo 'hi'" |