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でuptimeを取得するワンライナー | |
# | |
# 1.TimeSpan型のオブジェクトを返すバージョン | |
# PowerShellらしくオブジェクトで返す。後続の処理と連携させたい場合等に。 | |
# | |
&{$w=gwmi Win32_OperatingSystem;$w.ConvertToDateTime($w.LocalDateTime)-$w.ConvertToDateTime($w.LastBootUpTime);} |
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
# | |
# ゆゆ式ドラマCD一般発売記念アイコン327個を一括ダウンロードするコマンド (PowerShell版) | |
# | |
# @guitarrapc_techさんに教えて頂きました。 | |
# https://twitter.com/guitarrapc_tech/status/449560832687370240 | |
# | |
# PowerShell3.0以上で動作します。 | |
# | |
1..327 | %{$x="ys_$_.png";irm http://www.yuyushiki.net/core_sys/images/main/cont/special/ys_ico/$x -Outfile .\$x} |
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版 | |
# 日曜始まりの当月のカレンダーを表示します。 | |
# 土曜日は青色、日曜日は赤色で表示されます。 | |
# | |
$Today = (Get-Date).Date; $Year = $Today.Year; $Month = $Today.Month; | |
$CharWidth = 2; $SpaceWidth = 1; $DefaultColor= 'White'; | |
Write-Host ( "{0:yyyy/MM}" -F $Today).PadLeft(($CharWidth * 7 + $SpaceWidth * 6) / 2 + 4 ) -ForegroundColor:$DefaultColor; | |
Write-Host "".PadLeft(($CharWidth + $SpaceWidth) * (Get-Date -Year $Year -Month $Month -Day 1).DayOfWeek) -NoNewline; | |
1..[DateTime]::DaysInMonth($Year, $Month) | ForEach-Object { |
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からWindows FormsのMonthCalendarを表示する邪道なカレンダースクリプト。 | |
# | |
Add-Type -AssemblyName System.Windows.Forms | |
Try { | |
$Form = New-Object System.Windows.Forms.Form | |
$Form.Text = "邪道カレンダー" | |
$Form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow | |
$Calendar = New-Object System.Windows.Forms.MonthCalendar | |
$Form.Controls.Add($Calendar) |
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
' | |
' プロ生ちゃん #カレンダープログラミング プチコンテスト用カレンダー VBScript版 | |
' 日曜日始まりの当月のカレンダーを表示します。 | |
' このスクリプトはCScript.exeから実行してください。 | |
' | |
Option Explicit | |
If InStr(LCase(WScript.FullName), "wscript.exe") > 0 Then | |
MsgBox "このスクリプトはCScript.exeから実行してください。", vbOKOnly + vbCritical, "プロ生ちゃんカレンダー": Wscript.Quit | |
End If | |
Dim i,c,s,n,l,m: c = 2: s = 1: n = Now: m = "" |
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 | |
Add-Type -AssemblyName System.Configuration | |
# アプリケーション構成ファイルを読み込む | |
$Map = New-Object System.Configuration.ExeConfigurationFileMap | |
$Map.ExeConfigFilename = ".¥Sample.config" | |
$Config = [System.Configuration.ConfigurationManager]::OpenMappedExeConfiguration($Map, [System.Configuration.ConfigurationUserLevel]::None) | |
# 設定値の取得、更新 | |
$Setting = $Config.AppSettings.Settings["MY_KEY"] |
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
REM | |
REM Windows Defenderの定義更新を定期的に行うタスクを登録するスクリプト | |
REM schtasksコマンドを使用したバージョン | |
REM ※要管理者権限 | |
REM Windows 7で動作確認しています。 | |
REM | |
schtasks.exe /Create /RU system /SC HOURLY /TN "Windows Defender Update" /TR "'C:\Program Files\Windows Defender\MpCmdRun.exe' -SignatureUpdate -MMPC" /ST "01:00:00" |
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
--- ./guest_network.rb.orig 2015-01-06 13:42:26.000000000 +0900 | |
+++ ./guest_network.rb 2015-01-21 11:40:38.341846700 +0900 | |
@@ -40,8 +40,8 @@ | |
def configure_dhcp_interface(nic_index, net_connection_id) | |
@logger.info("Configuring NIC #{net_connection_id} for DHCP") | |
if !is_dhcp_enabled(nic_index) | |
- netsh = "netsh interface ip set address \"#{net_connection_id}\" dhcp" | |
- @communicator.execute(netsh) | |
+ command = "&{exit (Get-WMiObject Win32_NetworkAdapterConfiguration -Filter \"Index=#{nic_index}\").EnableDHCP().ReturnValue}" | |
+ @communicator.execute(command) |
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 | |
IPアドレスからサブネットマスク、ネットワークアドレス、ブロードキャストアドレスを計算します。 | |
ipcalcコマンドと同等の機能になりますが、IPV4のみに対応しています。 | |
.DESCRIPTION | |
.EXAMPLE | |
Calculate-IPAddress -CalcType Subnet,Broadcast,Network -Address 192.168.123.45/21 | |
Calculate-IPAddress -CalcType Prefix,Broadcast,Network -Address 192.168.123.45 255.255.254.0 | |
#> |
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 | |
NICTからJSONで公開されている現在時刻を取得してシステム時刻を更新します。 | |
.DESCRIPTION | |
NICTで公開されているJSON形式の時刻情報を取得してシステムの現在時刻を更新します。 | |
-WhatIf、-Verboseオプションをサポートしています。 | |
システム時刻を更新するには昇格している必要があります。 | |
また、時刻の取得に時間がかかりすぎた場合は処理を中断する様にしています。 | |
.PARAMETER URI |
OlderNewer