0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AzureADアカウントのみでPCを半自動インストールし、ユーザプロファイルをDに置く

Posted at

経緯

  • AzureADを参加ずみPCで、ローカル管理者アカウントがのこっていることがありますが、情シス的にはあまりよろしくありません。
  • 今回PCを再インストールするタイミングで、ローカル管理者を作らずに、AzureADアカウントだけでキッティングができるか検証してみます。
  • ついでにユーザプロファイルをDにおいてみたいと思います。

結論
ローカルアカウントが最初から存在せず、Dにユーザプロファイルを置くことで、セキュリティと管理性が向上しそうです。

autounattend.xmlの作成

こちらのページのコンフィグを使用させていただきました。

Windows 10を全自動で最後まで手間要らずでインストールする方法
http://www.neko.ne.jp/~freewing/software/windows_10_autounattend_xml_install/

269、272行目を変更します。また、ローカルアカウントの作成部分を削除します。

.xml
<HideWirelessSetupInOOBE>false</HideWirelessSetupInOOBE>
<SkipMachineOOBE>false</SkipMachineOOBE>
  • AzureAD参加に必要のためWIFIのセットアップ画面を出します。
  • できるだけ自動化しつつ、OOBE画面で止めて監査モードに入るためとなります。

relocate.xmlの作成

こちらのページのコンフィグを使用させていただきました。

ユーザプロファイルを別ドライブにつくる
https://qiita.com/syakesalmon/items/6c9e211bd900bce19558

.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
  <settings pass="oobeSystem">
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <FolderLocations>
        <ProfilesDirectory>D:\Users</ProfilesDirectory>
      </FolderLocations>
    </component>
  </settings>
</unattend>

Win10のUSB作成

RufusでISOから作成し、ルートに2つのXMLを置きます。
image.png

sysprepを実行するためのbatファイルも置いておきます。

USBからVM起動

ProxmoxにUSBメモリをパススルーし、起動順を変えます。実機だとUEFIで変更してください。
image.png
image.png

パーティション変更

USBから起動すると、いろいろとスキップされてパーティション作成画面になります。
image.png
Dドライブも区切っておきます。Dだけフォーマットも必要です。

監査モードに入る

OOBE画面でShift + Ctrl + F3を押し、監査モードに入ります。
image.png

監査モードが起動したら、GUIのSysprepは閉じます。
image.png

Sysprep実行

DドライブにバッチファイルとXMLファイルを配置し、Sysprepを実行します。

.bat
C:\Windows\system32\sysprep\sysprep.exe /generalize /oobe /reboot /unattend:d:\relocate.xml

image.png
image.png

AzureADでログイン

再起動するとふたたびOOBE画面になるので、入力します。セキュリティ更新などがかかります。
「組織用」を選択し、DEM管理者アカウントで登録します。
image.png
デバイスの診断データなど、つづきのOOBEはスキップできず設定することになります。
image.png
image.png

動作確認

AzureADに参加済みか確認します。

.ps1
dsregcmd /status

image.png
Dドライブにユーザプロファイルができています。
image.png

デスクトップにファイルを作成しても反映されます。
image.png

一般ユーザ権限では、Cドライブの他のフォルダにはアクセスやコピーや削除ができません。
image.png

ローカルアカウントはdefaultuser0というのが出来ていました。サイズは0でした。これらもアクセス保護されています(Userはテストフォルダ)。パブリックはアクセスできます。
image.png

まとめ

  • autounattend.xmlでインストールを半自動化し、relocate.xmlでユーザプロファイルをDに置くことができました。
  • ローカルアカウントが最初から存在せず、Dにユーザプロファイルを置くことで、セキュリティと管理性が向上しそうです。

参考にさせていただいたサイト

Windows 10を全自動で最後まで手間要らずでインストールする方法
http://www.neko.ne.jp/~freewing/software/windows_10_autounattend_xml_install/

ユーザプロファイルを別ドライブにつくる
https://qiita.com/syakesalmon/items/6c9e211bd900bce19558

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?