Last active
September 9, 2022 08:30
-
-
Save TreyBastian/baf311c58c9a575c261c9711286a882b to your computer and use it in GitHub Desktop.
UO Outlands Network Drive Profile Mapper
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
# Copyright 2022 Trey Bastian | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
# File must be run from loccal machine with ExecutionPolicy ByPass (example powershell -ExecutionPolicy Bypass \\networkpath\\setup.ps1) | |
# Outlands Install Location | |
$OUTLANDS_INSTALL_LOCATION="C:\Program Files (x86)\Ultima Online Outlands" | |
# Classic UO Profile Location | |
$CLASSICUO_PROFILE_FOLDER="./classicuo_profiles" | |
# Razor Profile Location | |
$RAZOR_PROFILE_FOLDER="./razor_profiles" | |
# Razor Macros Location | |
$RAZOR_MACROS_FOLDER="./razor_macros" | |
# Razor Scripts Location | |
$RAZOR_SCRIPTS_FOLDER="./razor_scripts" | |
# We are now going to check for admin privlages | |
if(!(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
clear-host | |
write-host " _ _ ____ ____ _ _ _ " -ForegroundColor Green | |
write-host " | | | |/ __ \ / __ \ | | | | | | " -ForegroundColor Green | |
write-host " | | | | | | | | | | |_ _| |_| | __ _ _ __ __| |___ " -ForegroundColor Green | |
write-host " | | | | | | | | | | | | | | __| |/ _` | '_ \ / _` / __| " -ForegroundColor Green | |
write-host " | |__| | |__| | | |__| | |_| | |_| | (_| | | | | (_| \__ \ " -ForegroundColor Green | |
write-host " \____/ \____/ \____/ \__,_|\__|_|\__,_|_| |_|\__,_|___/ " -ForegroundColor Green | |
write-host " " -ForegroundColor Green | |
write-host | |
write-host "Welcome to [RAT] Trey's UO Outlands Shared Profile Setup" -ForegroundColor Blue | |
write-host "This setup works by creating a link between this directories you are running this setup script in and the location in which UO Outlands expect it's profiles to exist." | |
write-host | |
write-host "This setup assumes UO OUtlands is installed in it's default location. If it's not you'll need to modify this script by changing the variable $OUTLANDS_INSTALL_LOCATION" -ForegroundColor Yellow | |
write-host "UO Outlands Path: ${OUTLANDS_INSTALL_LOCATION}" -ForegroundColor Blue | |
write-host | |
write-host "This script expects the profiles to be named as follows. You can change these by updating the variables at the top of this script" -ForegroundColor Yellow | |
write-host "Classic UO Profiles: ${CLASSICUO_PROFILE_FOLDER}" -ForegroundColor Blue | |
write-host "Razor Profiles: ${RAZOR_PROFILE_FOLDER}" -ForegroundColor Blue | |
write-host "Razor Macros: ${RAZOR_MACROS_FOLDER}" -ForegroundColor Blue | |
write-host "Razor Scripts: ${RAZOR_SCRIPTS_FOLDER}" -ForegroundColor Blue | |
write-host | |
# We aren't an admin let's display the messages and request admin access | |
write-host "The next step is going to request admin privlages to create that link. Windows requires admin privlages for such links as a security measure as symbolic links can be used for common attacks. All we are doing with this permision is creating a symbolic link and you can verify that by opening this installation script. All operations are annotated in comments." -ForegroundColor Yellow | |
write-host | |
pause | |
# We are relaunching powershell as administrator | |
Start-Process -FilePath 'powershell' -ArgumentList ('-ExecutionPolicy Bypass -noexit', '-File', $MyInvocation.MyCommand.Source, $args | %{ $_ } ) -Verb RunAs | |
exit | |
} | |
# Here we have Admin Privlages let's continue | |
Set-Location -Path $PSScriptRoot # Make sure we are back in the correct directory | |
write-host "Now running as Administrator" -ForegroundColor Yellow | |
write-host | |
# We are backing up our current profiles | |
if (Test-Path -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Profiles) { | |
write-host "Backing up old Classic UO Profiles to ${OUTLANDS_INSTALL_LOCATION}\ClassicUO\Data\Profiles-bak" | |
write-host | |
Rename-Item $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Profiles $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Profiles-bak | |
} | |
if (Test-Path -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Profiles) { | |
write-host "Backing up old Razor Profiles to ${OUTLANDS_INSTALL_LOCATION}\ClassicUO\Data\Plugins\Assistant\Profiles-bak" | |
write-host | |
Rename-Item $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Profiles $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Profiles-bak | |
} | |
if (Test-Path -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Macros) { | |
write-host "Backing up old Razor Macros to ${OUTLANDS_INSTALL_LOCATION}\ClassicUO\Data\Plugins\Assistant\Macros-bak" | |
write-host | |
Rename-Item $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Macros $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Macros-bak | |
} | |
if (Test-Path -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Scripts) { | |
write-host "Backing up old Razor Scripts to ${OUTLANDS_INSTALL_LOCATION}\ClassicUO\Data\Plugins\Assistant\Scripts-bak" | |
write-host | |
Rename-Item $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Scripts $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Scripts-bak | |
} | |
write-host "Setting up UO Outlands Profiles" | |
# We are creating the symbolic links to our configuration stored in shared drives | |
New-Item -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Profiles -ItemType SymbolicLink -Value $CLASSICUO_PROFILE_FOLDER | |
New-Item -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Profiles -ItemType SymbolicLink -Value $RAZOR_PROFILE_FOLDER | |
New-Item -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Scripts -ItemType SymbolicLink -Value $RAZOR_SCRIPTS_FOLDER | |
New-Item -Path $OUTLANDS_INSTALL_LOCATION\ClassicUO\Data\Plugins\Assistant\Macros -ItemType SymbolicLink -Value $RAZOR_MACROS_FOLDER | |
write-host | |
write-host "Setup Sucessful." -ForegroundColor Green | |
write-host "You do not need to run this file again when updating." | |
write-host "Enjoy :)" -ForegroundColor Blue | |
pause | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to include razor macros and scripts folders.