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
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 |
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 New-ZipCompress | |
{ | |
[CmdletBinding(DefaultParameterSetName="safe")] | |
param( | |
[parameter( | |
mandatory, | |
position = 0, | |
valuefrompipeline, | |
valuefrompipelinebypropertyname)] |
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 New-OSUser | |
{ | |
<# | |
.Synopsis | |
Create New user | |
.DESCRIPTION | |
User will create as you passed Credential. | |
.EXAMPLE | |
New-OSUser -Credential (Get-Credential) -Groups Administrators | |
# create new user with Group assigned Administrators |
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 UserAndGroup | |
{ | |
param | |
( | |
[parameter(Mandatory = 1)] | |
[PSCredential[]]$credential, | |
[parameter(Mandatory = 0)] | |
[string]$Group = "Administrators" | |
) |
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
# PowerShell の String中への変数埋め込みってば罠だらけね! | |
# 例 に示す変数をString中に表示するには5つ方法がある | |
$hoge = @{hoge = "hoge"} | |
$fuga = "fuga" | |
#1. 直 (Property指定がだめ | |
"$hoge" | |
'$hoge' | |
"$hoge.hoge" |
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
# Chef Recipe rule | |
[cookbook] 'Nae' do | |
[Key_name] "[key_value]" | |
[value_name] "[value_value]" | |
end | |
# Chef DSC call EnvironemtResource with : https://github.com/opscode-cookbooks/dsc | |
env 'editor' do |
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
# Do you think is work? NO........ | |
powershell_script "executionpolicy" do | |
code 'Set-ExecutionPolicy RemoteSigned' | |
not_if "(Get-ExecutionPolicy -Scope LocalMachine) -eq 'RemoteSiggned'" | |
end | |
powershell_script "smbsharelogs" do | |
code 'New-SMBShare logshare C:\logs' | |
not_if 'Get-SMBShare logshare' | |
end |