You need to be able to immediately run the iscsicli command successfully

You install Windows Server 2008 R2 (Server Core Installation) on a server.
You install the Hyper-V role and Windows PowerShell 2.0 on the server.
When you attempt to run an iscsicli command, the command fails.
You need to be able to immediately run the iscsicli command successfully.
What should you do?

You install Windows Server 2008 R2 (Server Core Installation) on a server.
You install the Hyper-V role and Windows PowerShell 2.0 on the server.
When you attempt to run an iscsicli command, the command fails.
You need to be able to immediately run the iscsicli command successfully.
What should you do?

A.
Run the ocsetup MultiPathIo command.

B.
Run the sc config msiscsi start= auto command.

C.
Run the start-service msiscsi PowerShell cmdlet.

D.
Run the set-service msiscsi CstartupType auto PowerShell cmdlet.

Explanation:
You can also use the command line to complete all actions required to configure the iSCSI
Initiator. The command line is necessary when using Server Core, since it has no graphical
user interface (GUI). Following are example commands that show how to enable and
configure the iSCSI Initiator using the command line.
First, you must enable the state of the iSCSI Initiator service and start the service using the
SC command:
1. Set the iSCSI Initiator service to start automatically:
sc \\localhost config msiscsi start= auto
2. Start the iSCSI Initiator service:
sc start msiscsi
3. Complete the remaining tasks using the iSCSI command-line interface (iscsicli):
•u Add the target portal:
iscsicli QAddTargetPortal <IP address of Portal>
•u Add the target:
iscsicli QAddTarget <iqn address of target>
•u Log in to the target:
iscsicli QloginTarget <iqn address of target>
•u Make Login Persistent
iscsicli PersistentLoginTarget <iqn address of target> i
T * * * * * * * * * * * * * * * 0
•u Bind all persistent volumes:
iscsicli BindPersistentVolumes

4. Confirm some critical settings by using these two command lines:
iscsicli ListPersistentTargets
iscsicli ReportTargetMappings
Start-Service
Applies To: Windows PowerShell 2.0
Starts one or more stopped services.
Syntax
Start-Service [-Name] <string[]> [-Exclude <string[]>] [-Include <string[]>] [-PassThru] [-
Confirm] [-
WhatIf] [<CommonParameters>]Start-Service -DisplayName <string[]> [-Exclude <string[]>]
[-
Include <string[]>] [-PassThru] [-Confirm] [-WhatIf][<CommonParameters>]
Start-Service [-InputObject <ServiceController[]>] [-Exclude <string[]>] [-Include <string[]>] [-
PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Description
The Start-Service cmdlet sends a start message to the Windows Service Controller for each
of the specified services. If a service is already running, the message is ignored without
error. You can specify the services by their service names or display names, or you can use
the InputObject parameter to supply a service object representing the services that you want
to start. Configuring iSCSI Initiators in Windows 2008 setting up iSCSI initiators from the
command line (cli). (It also gave me a reason to toy around in PowerShell (PS).)
Microsoft makes iSCSI initiator software available for Windows 2000,
Windows Server 2003, Windows XP, and is included natively for Windows
Server 2008 and Windows Vista. Our host details for this are:
HOSTs: redmond (initiator node), sunspot (target node)
OSes: Windows Server 2008 Standard SP2 (redmond)
Solaris 10 u8 (10/09 (sunspot))
PROMPTs: PS-redmond C:\> (PS on redmond)
cmd-redmond C:\> (standard cli on redmond) sunspot [0] (sunspot)
IP ADDRs: 10.0.136.25 (redmond), 10.0.136.12 (sunspot)
To start, the iSCSI initiator service (MSiSCSI) must be running, though if this is the the first
configuration of iSCSI devices, we’ll likely receive one of the two messages below indicating
that it is not:
PS-redmond C:\> iscsicli listtargets
Microsoft iSCSI Initiator Version 6.0 Build 6000
The Microsoft iSCSI initiator service has not been started.
PS-redmond C:\> iscsicli
Microsoft iSCSI Initiator Version 6.0 Build 6000
Error getting node name: The interface is unknown. Use the folllowing to configure MSiSCSI
to auto-start at boot, start it, and verify that it is running in PS:
PS-redmond C:\> set-service msiscsi -startuptype automatic
PS-redmond C:\> start-service msiscsi
PS-redmond C:\> get-service msiscsi
Status Name DisplayName
Running msiscsi Microsoft iSCSI Initiator Service
To do the same via the standard cli, use the following:
cmd-redmond C:\>sc config msiscsi start= auto
[SC] ChangeServiceConfig SUCCESS
cmd-redmond C:\>sc start msiscsi
SERVICE_NAME: msiscsi
TYPE : 20 WIN32_SHARE_PROCESS

STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID: 1028
FLAGS:
cmd-redmond C:\>sc query msiscsi
SERVICE_NAME: msiscsi
TYPE: 20 WIN32_SHARE_PROCESS
STATE: 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT: 0x0
WAIT_HINT : 0x0
c:\Users\Administrator>
If you have Windows Firewall enabled, update it to enable the
preconfigured iSCSI service rule:
PS-redmond C:\> netsh advfirewall firewall set rule “iSCSI Service (TCP-Out)” new
enable=yes
Updated 1 rule(s).
Ok.
Now we have MSiSCSI running and our firewall allows the initiator to establish connections
to our target host. Since don’t have any target hosts configured, ‘iscsicli listtargetportals’
below returns nothing:
PS-redmond C:\> iscsicli listtargetportals
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
Because I previously configured the target host to only allow known
intitiators to connect, we need to retrieve the iSCSI Node Name (INN) from ‘iscsicli’:
PS-redmond C:\> iscsicli
Microsoft iSCSI Initiator Version 6.0 Build 6000 [iqn.1991-05.com.microsoft:redmond] Enter
command or ^C to exit PS-redmond C:\>



Leave a Reply 0

Your email address will not be published. Required fields are marked *