Lapas

ceturtdiena, 2016. gada 7. aprīlis

Get server's all active users mapped disks and ports

Powershell script made by b.koehler:

function Get-MappedDrives($ComputerName){
  $output = @()
  if(Test-Connection -ComputerName $ComputerName -Count 1 -Quiet){
    $Hive = [long]$HIVE_HKU = 2147483651
    $sessions = Get-WmiObject -ComputerName $ComputerName -Class win32_process | ?{$_.name -eq "explorer.exe"}
    if($sessions){
      foreach($explorer in $sessions){
        $sid = ($explorer.GetOwnerSid()).sid
        $owner  = $explorer.GetOwner()
        $RegProv = get-WmiObject -List -Namespace "root\default" -ComputerName $ComputerName | Where-Object {$_.Name -eq "StdRegProv"}
        $DriveList = $RegProv.EnumKey($Hive, "$($sid)\Network")
        if($DriveList.sNames.count -gt 0){
          foreach($drive in $DriveList.sNames){
          $output += "$($drive)`t$(($RegProv.GetStringValue($Hive, "$($sid)\Network\$($drive)", "RemotePath")).sValue)`t$($owner.Domain)`t$($owner.user)`t$($ComputerName)"
          }
        }else{write-debug "No mapped drives on $($ComputerName)"}
      }
    }else{write-debug "explorer.exe not running on $($ComputerName)"}
  }else{write-debug "Can't connect to $($ComputerName)"}
  return $output
}

<#
#Enable if you want to see the write-debug messages
$DebugPreference = "Continue"

$list = "Server01", "Server02"
$report = $(foreach($ComputerName in $list){Get-MappedDrives $ComputerName}) | ConvertFrom-Csv -Delimiter `t -Header Drive, Path, Domain, User, Computer

$report | Out-GridView
#>


Source: technet.microsoft.com

pirmdiena, 2016. gada 4. aprīlis

Set default windows ip on server with multiple ip addresses

Run PowerShell.
Get interface name:
Get-NetAdapter

Set status "SkipAsSource":
Set-NetIPAddress –InterfaceAlias <Interface> –SkipAsSource $True

ceturtdiena, 2016. gada 11. februāris

Delete Offline Files Cache

 
  • Open Registry editor (Execute Regedit from Run window)
  • Go to this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSe\Services\Csc\Parameters
  • If Parameters key does not exist under CSC you can add it.
  • Now in the Parameters node create a new registry value with the name FormatDatabase of type REG_DWORD (i.e DWord 32-bit value)
  • Set the data in this new registry value to 1.
  • Close registry editor
  • Reboot the machine
Source: technlg.net

otrdiena, 2016. gada 9. februāris

Find HP ProCurves on network

Connect with telnet to core switch and run commands:
sho cdp neighbors det
or
sho lldp info remote-device 

Windows 10 expand jump list

If you want to see more Pinned and Recent item in your taskbar you need to modify/create these registry values
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\
Dword values - Start_JumpListItems and JumpListItems_Maximum