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
$fix = (Get-HotFix | findstr "KB3205409 KB3210720 KB3210721 KB3212646 KB3213986 KB4012212 KB4012213 KB4012214 KB4012215 KB4012216 KB4012217 KB4012218 KB4012220 KB4012598 KB4012606 KB4013198 KB4013389 KB4013429 KB4015217 KB4015438 KB4015546 KB4015547 KB4015548 KB4015549 KB4015550 KB4015551 KB4015552 KB4015553 KB4015554 KB4016635 KB4019213 KB4019214 KB4019215 KB4019216 KB4019263 KB4019264 KB4019472") | |
if([string]::IsNullOrEmpty($fix)) | |
{Write-Host -ForegroundColor Yellow -backgroundcolor red "************** UNSAFE patch me! ****************" | |
Write-Host -ForegroundColor yellow -backgroundcolor black "************** UNSAFE patch me! ****************" | |
Write-Host -ForegroundColor yellow -backgroundcolor red "************** UNSAFE patch me! ****************"} else {write-host -ForegroundColor Green "----------- SAFE :-) ---------------" | |
$fix} | |
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
dism /online /cleanup-image /startcomponentcleanup /resetbase |
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
import-module activedirectory | |
#finddomain or enter manually | |
#$domain = (Get-WmiObject Win32_ComputerSystem).Domain | |
#domain = my.domain.com | |
#edit for number of days to go back | |
$DaysInactive = 90 | |
$time = (Get-Date).Adddays(-($DaysInactive)) | |
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
Get-VM | Get-Snapshot | Select VM,Name,@{N="SizeGB";E={@([math]::Round($_.SizeGB))}},Created |
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
USE [msdb] | |
GO | |
BEGIN TRANSACTION | |
DECLARE @ReturnCode INT | |
SELECT @ReturnCode = 0 | |
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' | |
AND category_class=1) | |
BEGIN | |
EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', |
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
Get-VM | Get-NetworkAdapter | Where-object {$_.Type -ne "Vmxnet3"} | Select @{N="VM";E={$_.Parent.Name}},Name,type |
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
get-vm | select Name, @{N="IP1";E={@($_.guest.IPAddress[0])}}, @{N="IP2";E={@($_.guest.IPAddress[1])}}, @{N="IP3";E={@($_.guest.IPAddress[2])}}, @{N="IP4";E={@($_.guest.IPAddress[3])}} |
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
$folders = | |
$groupname = | |
$rootpath = | |
foreach ($folder in $folders) | |
{ | |
$path = $rootpath + $folder | |
New-DfsReplicatedFolder -GroupName $groupname -FolderName $folder | |
Set-DfsrMembership -GroupName $groupname -FolderName $folder -ComputerName WEB1 -ContentPath $path -PrimaryMember $true -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
function Get-NewestFile | |
{ | |
param($PathToDirectory) | |
$NewestFile = Get-ChildItem $PathToDirectory | sort LastWriteTime | select -last 1 | |
$PathToNewestFile = $PathToDirectory + "\" + $NewestFile | |
$PathToNewestFile | |
} |
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 connect-towebsite | |
{ | |
Param($siteURL) | |
cd "C:\Program Files (x86)\Google\Chrome\Application\" | |
for ($i=0; $i -lt 100; $i++) | |
{ | |
.\chrome.exe -incognito $siteURL | |
start-sleep 5 | |
get-process "*chrome*" | Stop-Process |
OlderNewer