Setup: Active directory domain with many domain controllers Problem: You want to move FSMO roles to another domain controller Solution: You can move the Active Directory (AD) from the command prompt using PowerShell in just a few seconds with PowerShell. Make sure you import the Active Directory PowerShell module: Transfer all the FSMO roles at […]
Articles Tagged: PowerShell
Get Cluster size for all disks and volumes on a Windows machine using PowerShell and WMI
Get Cluster size for all disks and volumes on a Windows machine using PowerShell and WMI Get-WmiObject -Query “SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem=’NTFS’” -ComputerName ‘.’ | Select-Object Label, Blocksize, Name See below an example of output:
Rescan all nodes of the cluster to find new SAN disk – PowerShell
Setup: A Windows cluster who was added a new SAN disk. Problem: Sometimes you need to scan each node for new disks in order to be able to add the disk in the cluster. Solution:
Compare group membership of two users in Powershell
Setup: Member server in Active Directory domain Problem: You need to compare group membership of two users Solution: Run this command in PowerShell The get-hash is a PowerShell hash function . Get-QADUser cmdlet is part of ActiveRoles
Compute a hash from a string in PowerShell
Setup: Computer with PowerShell installed Problem: Sometimes you want to create a hash from a string. Solution: Run this PowerShell script or include the function in your code: Example:
Retrieve passwords from IIS Application Pool with PowerShell remotely
Setup: Server with IIS installed and a remote computer with PowerShell Problem: IIS store the Application Pool Account password un-encrypted and is trivial to retrieve it. If you want to list all application pool accounts and their passwords use the following PowerShell command. You can even scan entire network/domain and make a list will all […]
Find LastLogon date on a server for all local and domain users
Setup: A Windows server member of a domain or workgroup Problem: You need LastLogon date for all the users who ever logged in on that server. Solution: Open PowerShell console and run this script:
Copy claim rules from one Relying Party to another in ADFS 2.0
Setup: Existing ADFS 2.0 installation Problem: You create a new Relying Party Trust and want to copy all the claim rules from existing Relying Party Solution: Open Power Shell console and run this code After that issue the folowing command: Tips: Run this command to find out all RP names:
Query HP server Storage Array details remotely via WMI and WBEM
Setup: A HP server with Windows OS and WMI enabled. Latest WBEM drivers installed. Problem: You want to query server details regarding the Storage Array Controller and disks installed. Solution: Run this PowerShell script from a remote computer.
Get system information from WMI remotely with PowerShell script
Setup: Remote computer with WMI enabled and firewall open Problem: You want to collect various information remotely Solution: Copy this script and save it on the disk with .ps1 extension. eg. Get-ComputerDetails.ps1 Open PowerShell console and execute the script. Tip 1: For unattended execution save the credentials on the disk and load them at run-time. […]