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
$d = 42 # Script scope | |
function bar | |
{ | |
$d = 0 # Function scope | |
[MyClass]::DoSomething() | |
} | |
class MyClass | |
{ |
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
# Present | |
configuration ACLChange | |
{ | |
Import-DscResource -ModuleName GraniResource | |
node Localhost | |
{ | |
File hoge | |
{ | |
Ensure = "Present" |
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
configuration present | |
{ | |
Import-DscResource -Modulename GraniResource | |
Node $AllNodes.Where{$_.Role -eq "localhost"}.NodeName | |
{ | |
cScheduleTask hoge | |
{ | |
Ensure = "present" | |
Execute = "powershell.exe" | |
Argument = "-Command 'Get-Date | Out-File c:\hoge.log'" |
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
configuration present | |
{ | |
Import-DscResource -Modulename GraniResource | |
Node $AllNodes.Where{$_.Role -eq "localhost"}.NodeName | |
{ | |
cScheduleTask hoge | |
{ | |
Ensure = "present" | |
Execute = "powershell.exe" | |
Argument = "-Command 'Get-Date | Out-File c:\hoge.log'" |
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
1..8 | % {$n="1" * $_; Write-Host ("{0,9} x {0,9} = " -f $n) -n;$x=("$n * $n" | iex); $x | %{$n=$_;$l=$_ -split "";[int]$z=($l.length-1)/2;$l | where {$_} | %{$i=1}{if($l.length -2 -eq 1){Write-Host $_ -Fo Red}elseif($i -eq $l.length - 2){Write-Host $_}elseif($i -eq $z){Write-Host $_ -n -Fo Red}elseif($i -lt $z){Write-Host $_ -n}elseif($i -gt $z){Write-Host $_ -n};$i++}}} |
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
#!/bin/sh | |
# script starts and stops the redis-server daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server | |
# config: /etc/redis/redis.conf | |
# config: /etc/sysconfig/redis | |
# pidfile: /var/run/redis.pid |
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-FileHashIndex | |
{ | |
<# | |
.Synopsis | |
Get File Hash for PowerShell V3 and Higher | |
.DESCRIPTION | |
Bringed C# how we retrieve File Hash to PowerShell Script. | |
This works equivalent to Get-FileHash (v4) but twice as faster and supports -Recurse switch. | |
measure-Command {Get-FileHashIndex -Path d:\test\test -Algorithm MACTripleDES -Recurse} # 684.4821 | |
measure-Command {Get-FileHashIndex -Path d:\test\test -Algorithm MD5 -Recurse} # 631.5687 |
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
#region Initializer | |
function New-WebPlatformInstaller | |
{ | |
[OutputType([Void])] | |
[CmdletBinding()] | |
param() | |
try | |
{ |
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-Office365LicenseFromUser | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Position = 0, Mandatory = 1, HelpMessage = "Pass MsolUser Objects.")] | |
[Microsoft.Online.Administration.User[]]$users | |
) |
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
configuration FixRemediateDriverIssue | |
{ | |
# DSC GraniResource : https://github.com/guitarrapc/DSCResources/tree/master/Custom | |
Import-DscResource -ModuleName GraniResource | |
cScheduleTask PlugAndPlayCleanup | |
{ | |
Ensure = "Present" | |
TaskName = 'Plug and Play Cleanup' | |
TaskPath = '\Microsoft\Windows\Plug and Play\' | |
Disable = $true |