Home

Wiki (private)

 Kornel 

 Blog Kornela 

Linux

Drugs

Berlin

Outside

Free Time

Contact

Impressum


Various Hints for MS Windows
  1. Do you know gpedit.msc? Take a look at it.
  2. Tool for Admins: mmc
  3. Remove MS Messanger: Open C:\WINDOWS\inf\sysoc.inf and change msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,hide,7 to msmsgs=msgrocm.dll,OcEntry,msmsgs.inf,7 Then use Add/Remove Windows Components to remove messenger
  4. -
Powerhsell

ping with timestamps

   ping.exe -t <hostname> | Foreach{"{0} - {1}" -f (Get-Date),$_}
        


variables

   $env:UserName
           $env:UserDomain
           $env:ComputerName
        

linux/gnu vs powershell

   | grep -i <string>
           | findstr /I <string>
           
           | sort
           | sort-object
           
           | wc -l
           | Measure-Object -line
        

show computer details

  • general computer infos
   $(Get-WMIObject -class Win32_ComputerSystem)
        
  • computer group membership
   ([adsisearcher]"(&(objectCategory=computer)(cn=$env:COMPUTERNAME))").FindOne().Properties.memberof -replace '^CN=([^,]+).+$','$1'
        

user infos

   $env:UserName
        

OR

   [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
        


   net user /domain <ad-username>
        

OR

   (New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:username)))")).FindOne().GetDirectoryEntry().memberOf
        

OR

   (New-Object System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=ad.user.name))")).FindOne().GetDirectoryEntry().memberOf
        

dump group membery

(fullgroupname beeing the full CN with all OU and DC)

   net group /domain fullgroupname
        

or

   $Group = [ADSI]"LDAP://CN=<fullgroupname>"
           $Group.Member | ForEach-Object { $Searcher = [adsisearcher]"(distinguishedname=$_)" ; $Searcher.FindOne().Properties.userprincipalname }