$Params = @{
Namespace = 'root\WMI'
class = 'MSFC_FCAdapterHBAAttributes'
ComputerName = $Computer
ErrorAction = 'Stop'
}
$HBAAdapters = Get-WmiObject @Params
foreach($HBA in $HBAAdapters){
$HBAInfo=@{
ComputerName = $HBA.__SERVER
NodeWWN = (($HBA.NodeWWN) | ForEach-Object {"{0:X2}" -f $_}) -join ":"
Active = $HBA.Active
DriverName = $HBA.DriverName
DriverVersion = $HBA.DriverVersion
FirmwareVersion = $HBA.FirmwareVersion
Model = $HBA.Model
ModelDescription = $HBA.ModelDescription
}
New-Object psobject -Property $HBAInfo
source
17 October 2016
Retrieve HBA information with powershell
13 October 2016
Find users with active sync enabled
Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.ActiveSyncEnabled -eq 'True'} | Select-Object name, activesyncenabled
12 October 2016
Generate file of speciefic size
param(
[string]$FileName,
[double]$FileSize
)
$FilePath = ((Get-Location).Path) + '\' + $FileName
$File = [System.IO.File]::Create($FilePath)
$File.SetLength($FileSize)
$File.Close()
Get-Item $File.Name
[string]$FileName,
[double]$FileSize
)
$FilePath = ((Get-Location).Path) + '\' + $FileName
$File = [System.IO.File]::Create($FilePath)
$File.SetLength($FileSize)
$File.Close()
Get-Item $File.Name
10 October 2016
Function arguments as reference
15 March 2016
Execute stored procedure in oracle database from powershell
$connectionString =“User Id=username;Password=password;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=appname.domain.intra)(PORT=1523)))(CONNECT_DATA=(SID=sid)))”;
$oracleConnection = new-object System.Data.OracleClient.OracleConnection($connectionString);
$ProcName = "procedure_name";
$oracleConnection.Open();
$cmd = new-object System.Data.OracleClient.OracleCommand;
$cmd.Connection = $oracleConnection;
$cmd.CommandText = $ProcName;
$cmd.CommandType = [System.Data.CommandType]::StoredProcedure;
$cmd.ExecuteNonQuery();
$oracleConnection.Close();
Subscribe to:
Posts (Atom)