Powershell for managing Storage Replicas
Posted: January 9, 2016 Filed under: powershell, Uncategorized, Windows Storage Replica Leave a commentPowershell to manage Storage Replicas
Get-Module -ListAvailable : List available modules
Get-Module : List modules loaded
Get-Module | ft Version,Name
Version Name ------- ---- 3.1.0.0 Microsoft.PowerShell.Management 3.1.0.0 Microsoft.PowerShell.Utility 1.1 PSReadline 1.0 StorageReplica
Get-Command -Module StorageReplica | ft CommandType,Name
CommandType Name ----------- ---- Function Clear-SRMetadata Function Export-SRConfiguration Function Get-SRDelegation Function Get-SRGroup Function Get-SRPartnership Function Grant-SRAccess Function Grant-SRDelegation Function New-SRGroup Function New-SRPartnership Function Remove-SRGroup Function Remove-SRPartnership Function Revoke-SRDelegation Function Set-SRGroup Function Set-SRPartnership Function Suspend-SRGroup Function Sync-SRGroup Cmdlet Test-SRTopology
Powershell and iSCSI
Posted: January 5, 2016 Filed under: iSCSI, powershell, Uncategorized Leave a commentPowershell module notes:
Get-Module : List loaded modules
Get-Module –ListAvailable : List available modules
iSCSI target (Run on machine exporting disks)
Import-Module IscsiTarget
Get-IscsiServerTarget
Get-IscsiVirtualDisk
iSCSI (Run on machine importing disks)
Import-Module iSCSI
Get-IscsiTargetPortal
Get-IscsiConnection
Get-IscsiSession
Get-IscsiTarget
Get-Disk | Format-List -Property Path,Size,IsReadOnly
(get-wmiobject -namespace ROOT\WMI -class MSiSCSIInitiator_SessionClass).Devices | Where-Object {$_.LegacyName -ne $null} | Select-Object -Property LegacyName,DeviceInterfaceName -unique | Format-List
Disable Access to a iscsi target from a given machine
Import-Module IscsiTarget
Get-IscsiServerTarget | Format-List -Property TargetName,InitiatorIds
TargetName : target1
InitiatorIds : {IPAddress:192.168.117.210, IPAddress:10.0.0.220, IPAddress:192.168.117.211, IPAddress:10.0.0.221}
TargetName : target2
InitiatorIds : {IPAddress:10.0.0.221, IPAddress:192.168.117.210, IPAddress:10.0.0.220, IPAddress:192.168.117.211
Set-IscsiServerTarget -TargetName target2 -InitiatorId @(“IPAddress:192.168.117.210″,”IPAddress:10.0.0.220″,”IPAddress:192.168.117.211”)
Immediately the iscsi session drops!
IIUG 2015 California Conference Pics
Posted: May 10, 2015 Filed under: powershell | Tags: powershell Leave a commentMy IIUG 2015 California Conference Pics (+ a few others) are at http://www.smooth1.co.uk/phone_pics/
The index.html was generated using http://www.smooth1.co.uk/powershell/htmldir.ps1
powershell script to register VMWare Workstation VMs
Posted: March 21, 2015 Filed under: powershell, VMWare | Tags: powershell, VMWare Leave a commentFirst realise that Powershell ISE in installed on windows 8 (and 8.1) by default!
Turn on Script Execution
Run powershell as administrator and run:
PS C:\Windows\system32> Get-ExecutionPolicy
Restricted
PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”):
PS C:\Windows\system32> Get-ExecutionPolicy
RemoteSigned
Adding
Obtaining Help
Run Powershell Ise as Admin and enter
Update-Help
to get the help files
Adding vmrun.exe to path
Go to Control Panel – System – Advanced – Environment Variables
Edit System Variable Path and add
;C:\Program Files (x86)\VMware\VMware Workstation
to the end of the path
Powershell Script to register VM’s
Script which when passed a location for VMWare Workstation virtual machines registers each vm with the gui.by opening and closing it! http://www.smooth1.co.uk/powershell/vmreg.ps1