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
########## | |
# Win10 Initial Setup Script | |
# Author: Disassembler <[email protected]> | |
# Version: 1.4, 2016-01-16 | |
# http://pastebin.com/gQxCUkLP | |
# Modified: Casey Gray, 2016-04-27 | |
########## | |
# Script Execution must be enabled | |
# Ask for elevated permissions if required |
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
<# | |
.SYNOPSIS | |
Resize photos to a specified size, 648 by default | |
Rename them and place them in a 'resized' folder | |
.EXAMPLE | |
Get-ChildItem -Path C:\Picures | Resize-ThumbnailPhoto | |
#> | |
Function Resize-ThumbnailPhoto |
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
if (Test-Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall) { | |
$gwreg = Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | foreach { | |
Get-ItemProperty $_.pspath | where { | |
$_.DisplayName -like '*GroupWise*' | |
} | |
} | |
} | |
else { | |
$gwreg = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | foreach { | |
Get-ItemProperty $_.pspath | where { |
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
Set-Location C:\GWCheck | |
Get-ChildItem . | % { | |
Get-Content $_.FullName -PipelineVariable log | % { | |
if ($log -match "\S*Checking user =*\S.([^\s]+)|[\s]+(\d+).\S*kbytes*\S") | |
{ | |
$matches[0] | Out-File -Append .\gwcheck.txt #"" | select @{n='User';e={$matches[1]}},@{n='Size';e={$matches[2]}} | |
} | |
} | |
} |
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
$users = get-aduser -Filter * -Properties proxyAddresses,EmailAddress | |
foreach ($u in $users) { | |
if (!($u.proxyAddresses -contains "SMTP:$($u.EmailAddress)")) { | |
$u.proxyAddresses.Add("SMTP:$($u.EmailAddress)") | |
Set-ADUser -Identity $u.SamAccountName -Add @{ 'proxyAddresses' = $($u.proxyAddresses) } | |
} | |
else { | |
Write-Host "$($u.name) already had the correct proxyaddresses" | |
} |
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
<# | |
.Synopsis | |
This Function will add "NT Authority\SYSTEM" to a folder ACL. | |
.DESCRIPTION | |
This Function will add "NT Authority\SYSTEM" to a folder ACL, specifically to \\folder\path\. | |
.EXAMPLE | |
Add-SystemToFolderACL \\folder\path\user1 | |
.EXAMPLE | |
Add-SystemToFolderACL user1,user2 | |
#> |
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
$tSize = 0 | |
Get-ChildItem -Path \\personal\users\ -Directory -Filter "of*arc" -Exclude '* *' -Recurse | % { | |
$pSize = 0 | |
Get-ChildItem $_.FullName -File -Recurse | % { | |
$pSize += $_.Length | |
$tSize += $_.Length | |
} | |
$pProps = New-Object psobject -Property @{ | |
'user'=$(($_.FullName -split '\\')[4]); | |
'size'=$($pSize) |
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
#The Third section will query each computer in the ListOfComputers.txt to get the members of the local group Administrators | |
#$Servers = (Get-ADComputer -Filter *).name | |
$output = 'c:\psresults\ListOfLocalAdministratorsGroup.txt' | |
$results = New-Object System.Collections.ArrayList | |
$objSID = New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544") | |
$objgroup = $objSID.Translate([System.Security.Principal.NTAccount]) | |
$objgroupname = ($objgroup.Value).Split("\")[1] | |
foreach($server in (Get-ADComputer -Filter *).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
<# | |
This is an attempt at a script to provision a DC VM in a disposable testlab | |
This will also set the DC as authoritative time source, DHCP, and DNS server | |
Windows Server® 2012 and 2012 R2 Core Network Guide | |
https://gallery.technet.microsoft.com/Windows-Server-2012-and-7c5fe8ea | |
#> | |
# rename the computer and reboot, this isn't needed if using Vagrant | |
#Rename-Computer -NewName newhost -Restart -Force |
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
if ($host.UI.RawUI.WindowTitle -like "Administrator:*") | |
{ | |
Write-Host -ForegroundColor Green "PowerShell is running as 'Administrator'..." | |
} else { | |
Write-Host -ForegroundColor Magenta "PowerShell is not running as 'Administrator'..." | |
} | |
# check if current user is in BUILTIN\Administrators (from https://github.com/tomasr/dotfiles/blob/master/.profile.ps1) | |
function Get-IsAdministrator | |
{ |
NewerOlder