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 | |
Modifies the web.config file for all servers for specific SharePoint web application. | |
.Description | |
Modifies the web.config file for all servers for specific SharePoint web application. | |
.Example | |
Add-SPCORSOrigin -Url http://domain.com | |
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
<# | |
Write a one-liner that produces the following output (note that property values will be different from computer to computer; that’s fine). | |
PSComputerName ServicePackMajorVersion Version· BIOSSerial | |
-------------- ----------------------- -------· ---------- | |
win81· · · · · · · · · · · · · · · · 0 6.3.9600 VMware-56 4d 09 1 71 dd a9 d0 e6 46 9f | |
By definition, a one-liner is a single, long command or pipeline that you type, hitting Enter only at the very end. If it wraps to more than one physical line as you’re typing, that’s OK. But, in order to really test your skill with the parser, try to make your one-liner as short as technically possible while still running correctly. | |
#> |
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
#Make a few test files | |
290..296 | %{ | |
"ham" > t:\"ham$($_)bacon.iso"} | |
#verify they were created | |
dir t:\*.iso | |
Mode LastWriteTime Length Name | |
---- ------------- ------ ---- | |
-a---- 12/2/2015 10:41 AM 12 ham290bacon.iso |
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
#ERASE ALL THIS AND PUT XAML BELOW between the @" "@ | |
$inputXML = @" | |
<Window x:Class="WpfApplication1.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:WpfApplication1" | |
mc:Ignorable="d" | |
Title="Window Title goes here" Height="350" Width="525"> |
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
$computername = 'localhost', $env:COMPUTERNAME | |
foreach ($Computer in $ComputerName) { | |
try { | |
quser /server:$Computer 2>&1 | Select-Object -Skip 1 | ForEach-Object { | |
$CurrentLine = $_.Trim() -Replace '\s+',' ' -Split '\s' | |
$HashProps = @{ | |
UserName = $CurrentLine[0] | |
ComputerName = $Computer | |
} |
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
$ErrorActionPreference = "Stop" | |
$Excel = new-Object -comobject Excel.Application | |
$Excel.visible = $True | |
$Excel = $Excel.Workbooks.Add() | |
$Sheet = $Excel.Worksheets.Item(1) | |
$Sheet.Cells.Item(1,1) = "Folder Name" | |
$Sheet.Cells.Item(1,2) = "Folder Permissions (allow)" | |
$Sheet.Cells.Item(1,3) = "Folder Permissions (Deny)" | |
$intRow = 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
#oh man, everyone elses were so much better, this is embarassing... | |
#v3 | |
$folder = 0 | |
$pgnFiles = 'X:\ChessData-master\ChessData-master' | |
$blacktot=$whitetot=$null | |
$blacktot = new-object System.Collections.ArrayList | |
$whitetot = new-object System.Collections.ArrayList | |
$draw = new-object System.Collections.ArrayList |
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
$Body = @" | |
[{ | |
"action": "EventsRouter", | |
"method": "query", | |
"data": [{ | |
"uid": "/zport/dmd/", | |
"params": { | |
"eventState": [0, 1], | |
"severity": [5, 4, 3, 2], | |
"excludeNonActionables": false |
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
#Sick of manually tracking down the SCOM Update Rollup version? Me too! Run this on a management server to get the Update Rollup version | |
#Find SCOM install path | |
$SCOMDirectory = get-childitem -Recurse c:\*\Console | ? PSIsContainer | select -First 1 | |
$SCOMDll = (get-item $SCOMDirectory\Microsoft.EnterpriseManagement.UI.Authoring.dll).VersionInfo.FileVersion | |
switch ($SCOMDll) | |
{ | |
'7.0.9538.0' {'SCOM 2012 SP1 RTM'} | |
'7.0.9538.1005' {'SCOM 2012 SP1 UR1'} |
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-Weather { | |
$city = "33.9533,-84.5406" | |
#sign up for an API key here https://developer.forecast.io/ | |
$APIkey = "$null" | |
$url = "https://api.forecast.io/forecast/$APIkey/$city" | |
try{$weather = Invoke-WebRequest $url -ea STOP|ConvertFrom-Json } | |
catch{write-host -ForegroundColor Yellow "We don't seem to have internet access" | |
break} |
OlderNewer