Schlagwort: powershell

  • Powershell as .bat

    As some Company has forbidden to use .ps1-files it comes handy to know how to implement the Powershell as an Batch/.bat-File: Put your code in an Editor of your choice and replace all breaklines with a ; and put your code as „one-liner“ behind this: powershell -command

  • Powershell for getting a CSV Adressbook out of an Active-Directory

    This is a little reminder to myself on how-to get a CSV list out of an standard Active Directory/ldap: [string] $ldapFilter = „(&(objectClass=User)(!(objectClass=Computer))(displayName=*, *)(telephonenumber=*))“; [string[]] $propLoad = @(„displayname“, „telephoneNumber“); [System.DirectoryServices.DirectoryEntry] $baseDn = New-Object „System.DirectoryServices.DirectoryEntry“ „LDAP://ldap…“; [System.DirectoryServices.DirectorySearcher] $searcher = New-Object „System.DirectoryServices.DirectorySearcher“ $baseDn, $ldapFilter, $propLoad, 2 $searcher.PageSize = [Int32]::MaxValue; [System.DirectoryServices.SearchResult] $result = $null; [string[]] $resultList = @();…