虚拟机-windows 修改密码

1、关机

2、备份卷

3、手动操作把系统卷挂载到别的vm上

4、复制cmd.exe 覆盖放大镜的exe文件

5、手动卸载

6、进入登录页面后点击放大镜的按钮,输入命令重置密码

当前密码 Tstack@123 1.关机

[root@openstack‐con01 ~(keystone_admin)]# nova list ‐‐all |grep 172.16.0.48

| 5d356c31‐b8eb‐430b‐af4a‐6c5947897126 | password

|

f6926fc084ea43e1a58496495c98f89f | SHUTOFF | ‐

| Shutdown

| tstack‐vxlan‐

network=172.16.0.48 |

  1. 备份卷

[root@openstack‐con01 ~(keystone_admin)]# cinder list ‐‐all |grep 5d356c31‐b8eb‐430b‐ af4a‐6c5947897126

| 8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482 | f6926fc084ea43e1a58496495c98f89f | in‐use |

| 50 | ceph_hdd | true | 5d356c31‐b8eb‐430b‐af4a‐6c5947897126 |

[root@openstack‐con01 ~(keystone_admin)]# rbd ‐p volumes ls |grep 8d82dba5‐7da8‐4f44‐ 9b34‐ace6fda71482

volume‐8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482

[root@openstack‐con01 ~(keystone_admin)]# rbd cp volumes/volume‐8d82dba5‐7da8‐4f44‐9b34‐ ace6fda71482 volumes/volume‐8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482_backup

Image copy: 100% complete...done.

  1. 手动操作把系统卷挂载到别的 centos vm 上
    1. 获取需要修改密码的 xml 内容

[root@openstack‐con01 ~(keystone_admin)]# nova show 5d356c31‐b8eb‐430b‐af4a‐6c5947897126

+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+

| Property | Value

|

+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+

| OS‐DCF:diskConfig | MANUAL

|

| OS‐EXT‐AZ:availability_zone | test2

|

| OS‐EXT‐SRV‐ATTR:host | openstack‐con02

|

| OS‐EXT‐SRV‐ATTR:hostname | password

|

| OS‐EXT‐SRV‐ATTR:hypervisor_hostname | openstack‐con02

|

| OS‐EXT‐SRV‐ATTR:instance_name | instance‐00000177

|

[root@openstack‐con02 ~]# virsh edit instance‐00000177

...

...

<disk type='network' device='disk'>

<driver name='qemu' type='raw' cache='none' discard='unmap'/>

<auth username='cinder'>

<secret type='ceph' uuid='0668cc5e‐7145‐4b27‐8c83‐6c28e1353e83'/>

</auth>

<source protocol='rbd' name='volumes/volume‐8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482'>

<host name='20.82.0.5' port='6789'/>

<host name='20.82.0.6' port='6789'/>

<host name='20.82.0.9' port='6789'/>

</source>

<target dev='vda' bus='virtio'/>

<serial>8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482</serial>

<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

</disk>

# 获取上面部分内容

[root@openstack‐con01 ~(keystone_admin)]# nova list ‐‐all |grep 172.16.0.47

| a29226bd‐c47c‐47c3‐947d‐9e829b26da14 | test‐no | f6926fc084ea43e1a58496495c98f89f | ACTIVE | ‐ | Running | tstack‐vxlan‐ network=172.16.0.47 |

[root@openstack‐con01 ~(keystone_admin)]# nova show a29226bd‐c47c‐47c3‐947d‐9e829b26da14

+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+

| Property | Value

|

+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐+

| OS‐DCF:diskConfig

|

| OS‐EXT‐AZ:availability_zone

|

| OS‐EXT‐SRV‐ATTR:host

|

| OS‐EXT‐SRV‐ATTR:hostname

| MANUAL

| test3

| openstack‐con03

| test‐no

|

| OS‐EXT‐SRV‐ATTR:hypervisor_hostname | openstack‐con03

|

| OS‐EXT‐SRV‐ATTR:instance_name | instance‐00000150

|

# 将需要修改密码的磁盘内容添加到辅助机器的 xml

[root@openstack‐con03 ~]# vim disk.xml

<disk type='network' device='disk'>

<driver name='qemu' type='raw' cache='none' discard='unmap'/>

<auth username='cinder'>

<secret type='ceph' uuid='0668cc5e‐7145‐4b27‐8c83‐6c28e1353e83'/>

</auth>

<source protocol='rbd' name='volumes/volume‐8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482'>

<host name='20.82.0.5' port='6789'/>

<host name='20.82.0.6' port='6789'/>

<host name='20.82.0.9' port='6789'/>

</source>

<target dev='vdb' bus='virtio'/>

<serial>8d82dba5‐7da8‐4f44‐9b34‐ace6fda71482</serial>

</disk>

# <target dev='vdb' bus='virtio'/> 修改这里不是 vda

# <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> 这行内容删除

# attach 到辅助机器,辅助机器需要时开机状态

virsh attach‐device instance‐00000150 disk.xml

# 辅助 vm centos 需要安装 ntfs

```bash

[root@1111 ~]# yum install ntfs‐3g‐2017.3.23‐11.el7.x86_64.rpm

挂在

mkdir /data/ mount -t ntfs /dev/vdb2 /data

[root@1111 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 458K 0

rom

vda 252:0 0 20G 0 disk ├─vda1 252:1 0 2M 0 part ├─vda2 252:2 0 500M 0 part /boot

├─vda3 252:3 0 2G 0 part │ └─centos-swap 253:0 0 2G 0 lvm [SWAP] ├─vda4 252:4 0 1K 0

part └─vda5 252:5 0 17.5G 0 part / vdb 252:16 0 50G 0 disk ├─vdb1 252:17 0 500M 0 part

└─vdb2 252:18 0 49.5G 0 part /data [root@1111 ~]# cd /data/ [root@1111 data]# ls bootmgr cloudagent Documents and Settings PerfLogs Program Files Recovery salt Users BOOTNXT cloud_config pagefile.sys ProgramData Program Files (x86) $Recycle.Bin System Volume Information Windows

4、复制 cmd.exe 覆盖放大镜(Magnify.exe)的exe文件

```bash

[root@1111 System32]# pwd

/data/Windows/System32

[root@1111 System32]# ls |grep cmd.exe cmd.exe

dsregcmd.exe

[root@1111 System32]# ls |grep Magnify.exe Magnify.exe

[root@1111 System32]# mv Magnify.exe Magnify.exe.backup [root@1111 System32]# cp cmd.exe Magnify.exe

umount 如果卸载不掉,重启下辅助 vm 释放

5、手动卸载

[root@openstack‐con02 ~]# virsh detach‐device instance‐00000156 disk.xml Device detached successfully

6、开机,进入登录页面后点击放大镜的按钮,输入命令重置密码

posted @ 2023-04-25 10:24  XU-NING  阅读(243)  评论(0编辑  收藏  举报