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 PipelineExecuteOnEndProcessingStyle | |
{ | |
param | |
( | |
[parameter(Position = 0, Mandatory = 1, ValueFrompipeline = 1, ValueFromPipelineByPropertyName = 1)] | |
[string]$hostaddress | |
) | |
begin{ $hostaddresses = @() } | |
process | |
{ |
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
Add-Type -TypeDefinition @" | |
public enum ValentiaBranchPath | |
{ | |
Application = 1, | |
Deploygroup = 2, | |
Download = 3, | |
Maintenance = 4, | |
Upload = 5, | |
Utils = 6 | |
} |
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
Enum ValentiaBranchPath | |
{ | |
Application = 1 | |
Deploygroup = 2 | |
Download = 3 | |
Maintenance = 4 | |
Upload = 5 | |
Utils = 6 | |
} |
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
######################## | |
# Constructor Call check | |
######################## | |
class Hoge | |
{ | |
Hoge() | |
{ | |
Write-Host "constuctor called" | |
} | |
} |
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
Class CopyItemClass | |
{ | |
[string]$Path | |
[string]$Destination | |
[string]$Item | |
[PSObject] SetItem([string]$Path, [string]$Destination) | |
{ | |
$result = copy-Item -Path $Path -Destination $Destination -PassThru | |
Write-Warning ("Item Copied from {0} to {1}" -f $Path, $Destination) |
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++}}} |