syg_hira's tech-work memo

某人材サービス会社の情報共有インフラ担当のおぼえがきです。MicrosoftのEnterprise製品多め。

Windows 10 Enterprise LTSB

Windows 10 がリリースされて2日経ちました。

MSDNサブスクリプションから、インストール用ISOをダウンロードしようとしたところ、Windows 10 Enterpriseに2つのバリエーションがあることに気がつきました。

Windows 10 Enterprise
Windows 10 Enterprise LTSB

無印とLTSBの違いについて調べてみました。


LTSB:Long Term Service Branch
Windows Updateで、「重要な更新プログラム」に含まれる「セキュリティ更新プログラム」「重要な更新プログラム」のみが適用される。

重要な更新プログラムに含まれないとされる
・推奨される更新プログラム
Service Pack
これらは、Windows Updateで展開されない、ということのようです。

会社の業務でWindowsを使用していて、内部統制やアプリ互換性のため、Windows Updateによる不用意な追加機能のインストールを防ぎたい場合に使用するエディションのようです。
ただ、Windows Updateの挙動はグループポリシーで管理できると思うの、なぜ個のエディションが必要なのか、利用シーンがよく分かりませんが・・・

Using file hash in PowerShell

I am working with PowerShell to maintenance systems.
I managed many scripts manually in this situation.
I confirmed file size and timestamp to identify the script version.

It is hard to deploy because server and script is too many.

I had made a script to enumerate filehash.

$stream = New-Object IO.StreamReader  
# MD5ハッシュ値を計算する 
$md5 = [System.Security.Cryptography.MD5]::Create() 
$hash = $md5.ComputeHash($stream.BaseStream); 
$result = [System.BitConverter]::ToString($hash).ToLower().Replace("-","") 
Write-Output $result 
$stream.Close()

The file compression in script on Windows. CAB is good, ZIP is not good.

If you want to know how to compress files in script(PowerShell, VBScript ...)and implemented with only windows builtin function, you may find "operate ZIP folder provided Windows Shell object"
But it is not stable on production server.
I implemented file compression batch with powerShell, Windows.Shell process is crashed and powershell.exe process is dead.
Because of killing PowerShell.exe, error handl block( try - Catch ) is not work.

I suppose to use CAB compresion.
See this article.

how to use - makecab.exe(updated)

Makecab.exe, it's file compress and packaging tool.
Makecab capable of making install package.
But,I will compress files to CAB.

Goal

  • Make single CAB file.I will not split CAB file that size is same as legacy media(FD,MO,CD and etc)
  • no subfolders to contain splited CAB files
  • no file created for install package
makecab.exe /D CabinetNameTemplate=CABFilePath /D RptFileName=nul /D InfFileName=nul /D DiskDirectoryTemplate= /D MaxDiskSize=0 SorceFilePath

Parameters
CABFileName:Path of CAB file to create.
SorceFilePath:Name of file list. It is contained file path of files to be contained in CAB.

RptFileName and InfFileName is nul: these file is used to install package.
DiskDirectoryTemplate is blank: we do not haev to make CAB in any subfolder to splited files.
MaxDiskSize is 0: We donot have to split file.

STOP: c00002e2 ... when boot domain controller on Hyper-V

I had a windows 2008 R2 active directory domain controller, it's running on hyper-v virtual machine.
The DC had a NTDS directory on D drive.
The VM had used a differencial VHD.
I had merge the virtual disk from differencial to new single vhd.

After merging VHD, attach the new VHD and boot domaincontroller.
I had encount the error as bellow.


STOP: c00002e2 Directory services could not start because of the following error:

Error Status: 0xc000001.
please shutdown this system and reboot into Directory Services restore Mode, check the event log for more detailed information.


Resolution

  1. Press F8 key on start up
  2. Select "Directory Service Restore mode" and Press Enter
  3. Log on as ".\Administrator" with the password for "Directory Service Restore mode".
  4. Open NTDS directory("D:\NTDS" in my case, Windows default may be "C:\Windows\NTDS")
  5. rename "*.log"(rename to "*.log.bak" in my case)
  6. restart VM

BOOTMGR is missing

Hyper-Vゲストが突然 BOOTMGR is missing を出して起動しなくなった。
宅鯖の仮想マシンをAzureにアップロードしようと、差分仮想ディスク(VHDX)を別VHDに結合していたら、なにかやってしまったらしい。

ネットでいろいろ調べたが、この手順で成功。
BOOTMGR is missing in Windows Server 2008 R2

Windows Server 2008 R2だが、Windows 7 インストールディスクの自動修復で回復させると一発だった。

export event log on remote machine with wevtutil

when wevtutil 'remote' option is specifies, is a local path on remote machine. not UNC...It's tricky.

example

Remote Machine:RServer

wevtutil export-log "System" "D:\Log\Exported\Sys.evtx" /Remote:LServer

The file will exported as \\RServer\D$\Log\Exported\Sys.evtx