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
# you must be logged in to the terminal server in question. | |
$session = New-PSSession -ComputerName $ComputerName # this must be the name of the DC whose session you must import. | |
Invoke-Command -ScriptBlock {Import-Module ActiveDirectory} -Session $session | |
Import-PSSession -Module activedirectory -Session $session | |
$ou = Get-ADOrganizationalUnit -Filter * -Properties * | where-object name -match "$OUName" | |
$users = Get-ADUser -Filter * -Properties * | Where-Object distinguishedname -Match $ou.distinguishedname |
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
<# | |
Sample DSC Configuration for a DNS/DHCP Server | |
DNS is configured to house addresses for a server pool and a sql server | |
DHCP is configured for reservations to the server pool | |
Script was tested in a DSC push configuration. | |
Tested using Server 2012 R2 DC Core running PowerShell v4. | |
Server is not joined to a domain. | |
Test Server has two virtual network interfaces with one configured as "TestInt". | |
Before testing, please run the following on the test server: | |
winrm qc |
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
$scriptblock = {choco.exe install adobereader -y | |
choco.exe install openoffice -y} | |
$servers = Get-ADComputer -Filter * -Properties * | Where-Object name -match $SomeName | |
foreach ($s in $servers){ | |
$session = new-pssession $s | |
Invoke-Command -ScriptBlock $scriptblock -Session $session | |
} |
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
PhysVol = "$1" | |
VolSize = "$2" | |
MountDir = "$3" | |
pvcreate $PhysVol | |
pvdisplay $PhysVol | |
vgcreate volgrp1 $PhysVol | |
lvcreate -L $VolSize -n LogVol1 |
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
## This script was tested using Python 2.7.9 | |
## The MWClient library was used to access the api. It can be found at: | |
## https://github.com/mwclient/mwclient | |
import mwclient | |
site = mwclient.Site(('https', 'en.wikipedia.org')) | |
site.login('$user', '$pass') # credentials are sanitized from the script. | |
listpage = site.Pages['User:$user/World_of_Warcraft'] # page is sanitized. | |
text = listpage.text() | |
for page in site.Categories['World_of_Warcraft']: |
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
$SqlInstance = 'MsSqlServer' | |
$QuietSimple = $true | |
$x86 = $false | |
$InstanceName = 'SqlExpress' | |
$Pass = 'P@$$w0rd' | |
$chocopath = 'c:\programdata\chocolatey' | |
$Source = @" | |
;SQL Server 2012 Configuration File | |
; SQL-2012-Base.ini |
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 Set-UEFIActivation{ | |
<# | |
.NAME | |
Set-UEFIActivation | |
.AUTHOR | |
Jonathan Bailey | |
.SYNOPSIS | |
Pulls the Product key hex value from the motherboard, converts it to ASCII, and pipes it to slmgr.vbs for activation. | |
.SYNTAX | |
Set-UEFIActivation [-OA3ToolPath] <string> |
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 Remove-Checkpointsforexport{ | |
Param( [ValidateSet('All','RDP','SQL','DC')] | |
$VMScope ) | |
BEGIN{} | |
PROCESS{ | |
switch ($VMScope){ | |
ALL { $VMs = Get-VM } | |
RDP { $VMs = Get-VM | Where-Object name -Match 'RDP' } | |
SQL { $VMs = Get-VM | Where-Object name -Match 'SQL' } | |
DC { $VMs = Get-VM | Where-Object name -Match 'DC' } |
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
New-RdpVmConfig{ | |
Param( $Name, | |
$SwitchName, | |
$VhdPath, | |
$Path ) | |
BEGIN{} | |
PROCESS{ | |
New-VM -Name $Name -MemoryStartupBytes 2048 -BootDevice VHD -SwitchName $SwitchName -VHDPath $VhdPath -Path $Path -Generation 1 | |
Set-VM -Name $Name -ProcessorCount 4 -DynamicMemory $true -MemoryMinimumBytes 2048 | |
Enable-VMIntegrationService -VMName $Name |
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 Set-SSSLegacyConsoleSettings{ | |
BEGIN{ | |
$checkwin10 = Gcim win32_operatingsystem | |
} | |
PROCESS{ | |
if ($checkwin10.Name -notmatch 'Windows 10'){ | |
Write-Host 'No update needed. Operating system must be Windows 10.' -ForegroundColor Green | |
} | |
else{ | |
if ((Get-WindowsOptionalFeature -Online -featurename ntvdm).state -ne 'enabled'){ |
OlderNewer