VMware ESX vCenter Linux windows CCNA 忍者ブログ

IT号 着地号 いろいろ号

 ITに関しての調べ物です。バージョンや出展はつど記事に記載予定です。

カレンダー
11 2025/12 01
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
リンク
カテゴリー
かぶりもの
最新CM
[06/07 gay]
[02/16 gay]
[02/12 ヴィトン セカンドバッグ スーパーコピー ヴィトン]
[09/30 vente boutique canada goose paris]
[09/28 canada goose belgique]
最新記事
プロフィール
HN:
ESXi
性別:
非公開
バーコード
RSS
ブログ内検索
アーカイブ
最古記事
(01/14)
(01/20)
(01/20)
(01/26)
(01/26)
忍者アナライズ

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

2025.12.17 (Wed)
Category[]

Powershellの話


$beginDate = Get-Date -Date "2016/07/01"
$endDate = Get-Date -Date "2017/04/01"

#$a = @("taro1","jiro2","3ro","4ro","taro1","jiro2","taro1","jiro2","jiro2")
$a = Get-EventLog application -After $beginDate -Before $endDate | Where-Object { $_.EntryType -eq "Error" }
#$b = @(foreach($v in $a){ $v })

# 自分のディレクトリ
cd @@@@@

for ($i=0; $i -lt $a.Length; $i++){
$a | ? {
if(($a.Message -eq $_.Message).count -ge 2){
$_
}
} | sort | gu | out-file ./result.txt -encoding default
}
#http://d.hatena.ne.jp/sinjyama/20100817/1282035684

拍手[0回]

PR
2017.04.23 (Sun)
Category[Windows系]
Comment(0)

Pythonで英単語の出現回数を数える場合

# 単語の出現回数をカウント
text = """
Keep on asking, and it will be given you:
Keep on seeking, you will find;
Keep on knocking, and it will be opend to you;
for everyone asking receives, and everyone seeking finds,
and to everyone knocking, it will be opend.
"""

# 単語を区切る
text = text.replace(";","") # ;を削除
text = text.replace(",","") # ,を削除
text = text.replace(".","") # .を削除
words = text.split() # 空白で区切ってリスト型を作成

# 単語を数える
counter = {} # counterという空の辞書型を作成
for w in words:
ws = w.lower() # 小文字に変換
if ws in counter: # もし辞書型にすでにキーがあれば値を1つ追加
counter[ws] += 1
else:
counter[ws] = 1 # もし辞書型にキーがなければ、値を1としてキーも登録

# 結果を表示。3回以上のものだけを表示
for k,v in sorted(counter.items()): # counterのキーをアルファベット順として範囲に指定
if v >= 3:
print(k, v)

拍手[0回]

2017.04.15 (Sat)
Category[Python]
Comment(0)

PowerShell URL

https://social.technet.microsoft.com/Forums/ja-JP/b11495cc-99ce-409b-87d9-1caa3b41dec8/getwineventmessage?forum=powershellja

Get-WinEvent FilterXPath


http://mtgpowershell.blogspot.jp/2012/09/filterxpath.html


http://ubweb.info/pcmemo/kiji/mf1997.html

http://lsair.html.xdomain.jp/a/e/g13_182__powershell_3.html


http://blogs.wankuma.com/chuki/archive/2011/12/06/219150.aspx

http://azuread.net/2010/08/17/%E3%80%90%E5%86%8D%E6%8E%B2%E3%80%91%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%83%93%E3%83%A5%E3%83%BC%E3%82%A2%E3%81%AE%E3%82%AF%E3%82%A8%E3%83%AA%E3%82%92%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4-2/

<ファイの中身検索>
https://hosopro.blogspot.com/2014/02/powershell-select-string-2.html

拍手[0回]

2017.03.29 (Wed)
Category[Windows系]
Comment(0)

PowerShellの勉強

# 実行中のパス取得/移動
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $path

# サービスの実行状況
$RunningService = get-wmiobject win32_service | Where-Object {$_.State -eq "Running"} | select Name

# 正とするファイル読み込み
$fileName = $path + "\RunningOnly002.txt"
$file = New-Object System.IO.StreamReader($fileName, [System.Text.Encoding]::GetEncoding("sjis"))
while (($line = $file.ReadLine()) -ne $null)
{
Write-Host($line)
}
Write-Host("")
$file.Close()

# 終了
Write-Host("終了")






# 実行中のパス取得/移動
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $path

# サービスの実行状況
$RunningService = get-wmiobject win32_service | Where-Object {$_.State -eq "Running"} | select Name

# $RunningService を1行づつ読み込む。そして検索する。
foreach ($hoge in $RunningService){
Select-String -Path .\RunningOnly002.txt -Pattern $hoge
}










get-wmiobject win32_service | select Name,State,StartMode,StartName | sort Name | Export-csv C:\list.txt -encoding Default

get-wmiobject win32_service | select Name | sort Name | more


get-wmiobject win32_service | Where-Object {$_.State -eq "Running"} | select Name | more

get-wmiobject win32_service | select Name,State | Where-Object {$_.State -eq "Running"} | select Name | more
get-wmiobject win32_service | select Name,State | Where-Object {$_.State -eq "Running"} | Where-Object {$_.State -eq "Name"} | more
get-wmiobject win32_service | select Name,State | Where-Object {$_.State -eq "Running"} | more

http://www.atmarkit.co.jp/ait/articles/1004/15/news106.html
PowerShellではパイプを「オブジェクトもしくはその配列」が「プロパティ値を保持したまま」渡ることがポイントである。


http://nasunoblog.blogspot.jp/2014/01/powershell-get-service-matome.html
ステータスで並び替える
Get-Service | Sort-Object status
サービス名で並び替える
Get-Service | Sort-Object name
表示名で並び替える
Get-Service | Sort-Object displayname
降順で並び替える
Get-Service | Sort-Object displayname -Descending



http://qiita.com/kmr_hryk/items/9b0d28ed0fda5b34f07c
なんらかの事情で新旧で一致している行も表示したい場合には
PS> Compare-Object $A $B -IncludeEqual


get-wmiobject win32_service | select Name,State | Select-String "Running" | % { $_.Line } | more

get-wmiobject win32_service | select Name,State | Select-String "Running" | % { $_.Matches.Value } | more

Get-Content c:\list.txt | Select-String "Running" | more

拍手[0回]

2017.03.13 (Mon)
Category[Windows系]
Comment(0)

AD関連

@IT_AD関連

・一覧
http://www.atmarkit.co.jp/ait/series/1473/

・個別
http://www.atmarkit.co.jp/ait/articles/1411/11/news142.html#l_AD08_ga01.png
http://www.atmarkit.co.jp/ait/articles/0612/23/news012.html
http://www.atmarkit.co.jp/ait/articles/0604/22/news020.html
http://www.atmarkit.co.jp/ait/articles/1405/26/news024.html

http://www.atmarkit.co.jp/ait/articles/1408/22/news028.html
http://www.atmarkit.co.jp/ait/articles/0303/28/news002_2.html

拍手[0回]

2017.01.22 (Sun)
Category[Windows系]
Comment(0)
Copyright © ESXi All Right Reserved.
Powered by Ninja Blog.
Template-Designed by ガスボンベ.