This file contains hidden or 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-Credential | %{ | |
$user = $_.UserName | |
$pass = ConvertFrom-SecureString $_.Password | |
@" | |
<# | |
.SYNOPSIS | |
command with credential | |
#> | |
`$user = "$user" |
This file contains hidden or 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
$config = @" | |
"COMPUTER","IPAddress","Subnetmask","Gateway" | |
"ORANGE","192.168.0.6","255.255.255.0","192.168.0.1" | |
"BROWN", "192.168.0.7","255.255.255.0","192.168.0.1" | |
"@ | ConvertFrom-Csv | ?{$_.COMPUTER -eq $Env:COMPUTERNAME} | |
gwmi Win32_NetworkAdapterConfiguration | ?{$_.IPEnabled -eq $true -and $_.Description -match "WiFi"} | %{ | |
$_.EnableDHCP() | |
$_.EnableStatic($config.IPAddress, $config.Subnetmask) | |
$_.SetGateways($config.Gateway,1) |
This file contains hidden or 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 | |
ソフトウェアのバージョン情報を収集する | |
#> | |
$ps1_file = &{$myInvocation.ScriptName} | |
$base_dir = Split-Path (Split-Path $ps1_file) | |
$log_dir = "$base_dir\log" | |
$log_file = "$log_dir\$((Split-Path -Leaf $ps1_file).Replace(".ps1",".log"))" | |
if (-not (Test-Path "$log_dir")) {New-Item "$log_dir" -Force -ItemType Directory} |
This file contains hidden or 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 | |
クリップボート内の画像をファイルに出力します。 | |
#> | |
Function cap | |
{ | |
powershell -sta -command { | |
Add-Type -AssemblyName System.Windows.Forms | |
$cb = [Windows.Forms.Clipboard] | |
$img = $cb::GetImage() |
This file contains hidden or 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 sbt._ | |
import Keys._ | |
object TestBuild extends Build { | |
lazy val root: Project = Project("root", file("."), aggregate = nonRoots) | |
lazy val nonRoots = projects.filter(_ != root).map(p => LocalProject(p.id)) | |
lazy val sub1 = consoleProject("sub1", file("sub1")) | |
lazy val sub2 = webProject("sub2", file("sub2")) |
This file contains hidden or 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
gwmi -Namespace root\wmi WmiMonitorID | %{ | |
New-Object PSObject -Property @{ | |
ManufacturerName = -join ($_.ManufacturerName | %{[char]$_}) | |
ProductCodeID = -join ($_.ProductCodeID | %{[char]$_}) | |
SerialNumberID = -join ($_.SerialNumberID | %{[char]$_}) | |
UserFriendlyName = -join ($_.UserFriendlyName | %{[char]$_}) | |
WeekOfManufacture = $_.WeekOfManufacture | |
YearOfManufacture = $_.YearOfManufacture | |
} | |
} |
This file contains hidden or 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
name := "My Project" | |
version := "0.1-SNAPSHOT" | |
organization := "home" | |
unmanagedBase <<= baseDirectory / "lib" | |
sourceDirectory in Test <<= baseDirectory / "test" |
This file contains hidden or 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 sbt._ | |
import Keys._ | |
object TestBuild extends Build { | |
lazy val root: Project = Project("root", file("."), aggregate = nonRoots) | |
lazy val nonRoots = projects.filter(_ != root).map(p => LocalProject(p.id)) | |
lazy val main = consoleProject("main", file("main")) dependsOn(sub1, sub2, sub3) | |
lazy val sub1 = webProject("sub1", file("sub1")) |
This file contains hidden or 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
(date "2012/10/04 22:00").Subtract((date "1970/01/01 09:00")).TotalSeconds | |
((date "2012/10/04 22:00") - (date "1970/01/01 09:00")).TotalSeconds | |
date (date "2012/10/04 22:00").ToUniversalTime() -u "%s" | |
date (date "2012/10/04 22:00").AddHours(-9) -u "%s" | |
(date "2012/10/04 22:00" -u "%s") - 9*60*60 |
This file contains hidden or 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 IsAdministrator { | |
[Security.Principal.WindowsPrincipal]$id = [Security.Principal.WindowsIdentity]::GetCurrent() | |
$id.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) | |
} |
OlderNewer