1.命令行配置ISCSI。
开启iSCSI server && 设为”automatically” 自动–开机启动。
sc config msiscsi start= auto
net start msiscsi
2.使用iscsi命令行接口连接iSCSI目标、列出有效目标。
iscsicli QAddTargetPortal 192.168.1.31
3.列出目标
iscsicli ListTargets
4.连接目标
iscsicli qlogintarget TargetName
5.确认连接成功
iscsicli reporttargetmappings
6.断开目标
iscsicli logouttarget SESSIONID(如:0xfffffa800626e018-0x4000013700000006)
7.确认断开成功
iscsicli reporttargetmappings
*********************************************************************************************************
How to Automate Windows Diskpart Commands in a Scrip
Being able to automate disk partitioning, volume creation, and filesystem formatting can be very useful. It is especially handy for imaging processes, e.g. from a WinPE boot disk.
The windows diskpart command can be automated using a simple text file. Unfamiliar with Diskpart? Open Windows Command Processor (cmd.exe) and type:
diskpart
help
If you want help with a specific command, type:
help <command>
Where <command> is the command that you want help with.
To automate diskpart, you simply need to create a text file with your diskpart commands, then call diskpart from your command prompt or script and pass it the name of the text file.
For example, let’s say that you have booted a computer to WinPE, and wish to wipe the local “C:” drive and create a fresh one. To do so, open notepad.exe, then type the following:
select disk 0
clean
create partition primary
assign letter=C
active
format fs=ntfs label=Windows quick
Now save that as WipeC.txt and close Notepad.
Then run it like so:
diskpart.exe /s WipeC.txt
Please note that this example will completely remove the contents of the local Disk 0!
More specifically, it will: wipe all partitions off of Disk 0, create a single primary partition which will occupy the whole disk, assign that partition the drive letter C:, set it as active so that you can boot from it, and then create a volume called “Windows” formatted quickly as NTFS.