20 October 2016

Grant sharing permissions for multiple users with net share

net share sharename=path_to_folder /GRANT:username,FULL /GRANT:username2,FULL

18 October 2016

Get computer manufacturer and model

command prompt
wmic computersystem get model, manufacturer


powershell
Get-WmiObject Win32_ComputerSystem | Select-Object Manufacturer, Model


visual

msinfo32.exe

17 October 2016

Retrieve HBA information with powershell

$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

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