Skip to content

Instantly share code, notes, and snippets.

View skyhoshi's full-sized avatar
🎶
Focusing

Marcus Kern skyhoshi

🎶
Focusing
View GitHub Profile
@skyhoshi
skyhoshi / Get-ADComputersPropertiesAndIPAddresses
Last active March 6, 2020 00:36
This Script parses through all computers found in the domain. using the Object Class of Computer. (regardless of OU) : the problem I'm having is that the script outputs a loop index in one of the forgoing loops and I'm not sure how to prevent it.
function Get-ADComputersPropertiesAndIPAddresses {
[CmdletBinding(DefaultParameterSetName = 'Identification',
SupportsShouldProcess = $true,
PositionalBinding = $false,
HelpUri = 'https://www.github.com/skyhoshi/powershell',
ConfirmImpact = 'Medium')]
[Alias()]
[OutputType([String])]
Param
(
@skyhoshi
skyhoshi / Install to default location where folder container is VHD(x)
Last active September 29, 2023 14:39
This is a Gist to describe the VHDX Install folder project
Public: Github Project.
https://github.com/skyhoshi/VHDXToFolders
## Story
Project Story: (Use Case/ User Story/ My Experience)
History of the Project:
This project was one of necessity. After 20+ years of collecting, developing and loosing/misplacing projects and source files, When Windows 7 ( + Windows Server 2008) presented the ability to create Virtual Machines. Virtual Hard drives became a standard in storing a lot of “Shared” data. I had virtual hard drives that I would attach and detach from virtual machines to do maintenance and installations.
A few years ago with the introduction of Windows 10, Hyper-V and Hyper-V PowerShell Module I was able to script out the creation of Virtual Hard Drives and took the concept of sharing one step further by attaching these drives to folders (Folder Mounting).
Theories and Practice:
With this I could in theory, install games onto to my SSD drive but when I wasn’t playing the game but needed additional space on the then limited space of my SSD I could dismount a
@skyhoshi
skyhoshi / ProfileInit.ps1
Created August 12, 2020 17:43
Initialize Powershell Profiles
#if (!(Test-Path -Path ))
if ((Read-Host -Prompt "Initialize Profiles?").ToLower() -contains "y") {
$HostFile = $PROFILE.AllUsersAllHosts;
if (!(Test-Path -Path $HostFile)) {
$CreateHost = Read-Host -Prompt "Would you like to create $HostFile"
if ($CreateHost.ToLower() -contains "y") {
New-Item -ItemType File -Path $HostFile -Force
}
$CreateHost = "N";
}
@skyhoshi
skyhoshi / ScoopInstall.ps1
Last active March 15, 2022 21:47
Configure ServerBased Scoop
Set-ExecutionPolicy -ExecutionPolicy Unrestricted;
powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 2.8.5.201 -Scope CurrentUser -AllowClobber'
$ScoopGlobalRoot = "C:\Applications";
$Installers = "$ScoopGlobalRoot\Installers"
$env:SCOOP = "$ScoopGlobalRoot\$env:USERNAME\";
$env:SCOOP_GLOBAL = "$ScoopGlobalRoot\Global";
if (!(Test-Path -Path $env:SCOOP)) {
New-Item -ItemType Directory $env:SCOOP;
}
@skyhoshi
skyhoshi / AndroidSDKManager.ps1
Created September 21, 2020 16:32 — forked from AArnott/AndroidSDKManager.ps1
PowerShell script for automating the installation of Android SDKs
$AndroidToolPath = "${env:ProgramFiles(x86)}\Android\android-sdk\tools\android.bat"
if (!(Test-Path $AndroidToolPath)) {
$AndroidToolPath = "$env:localappdata\Android\android-sdk\tools\android.bat"
} elseif (!(Test-Path $AndroidToolPath)) {
Write-Error "Unable to find Android SDK Manager tools."
return
}
Function Get-AndroidSDKs() {
$output = & $AndroidToolPath list sdk --all
@skyhoshi
skyhoshi / ConsoleOutputLog.cs
Created June 13, 2022 20:15 — forked from mikey-t/ConsoleOutputLog.cs
Simple C# utility class to output to both console and a log file at the same time. Use it by simply calling Output.Write() and Output.WriteLine().
public class Output
{
private readonly string LogDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
private static Output _outputSingleton;
private static Output OutputSingleton
{
get
{
if (_outputSingleton == null)
@skyhoshi
skyhoshi / GenerateNewSSH.ps1
Created February 10, 2023 19:45
Create a new SSH Key
$RootProfileStore = "$($env.USERPROFILE)\.ssh";
$StoreLocation = "\";
$Filename = "NameOfSSHFile"
$PrefixFilename = "$(Filename).ssh"
$PathOnly = "$RootProfileStore$StoreLocation"
if (!(Test-Path -Path $PathOnly)){
New-Item -Path $PathOnly -ItemType Directory;
}
$Extension = "Id_rsa";
$FileName = "$($PrefixFilename).$($Extension)";