Rename & join a computer into a domain within a single powershell command

This command renames the local computer to and then restarts automatically. In my Test environment the command would be  alike: Rename-Computer -NewName "w2016DC2" -DomainCredential test.test\administrator -Restart which translates into: Rename-Computer -NewName "desired_name" -DomainCredential "domain\username"-Restart Modify the following parameters:  "w2016DC2" (your desired computer name) test.test\administrator ( AD account needed ) Domain admin credentials or either an … Continue reading Rename & join a computer into a domain within a single powershell command

Windows Updates Script

This is a little script which updates via PowerShell the operating system   #Define update criteria. $Criteria = "IsInstalled=0 and Type='Software'" #Search for relevant updates. $Searcher = New-Object -ComObject Microsoft.Update.Searcher $SearchResult = $Searcher.Search($Criteria).Updates #Download updates. $Session = New-Object -ComObject Microsoft.Update.Session $Downloader = $Session.CreateUpdateDownloader() $Downloader.Updates = $SearchResult $Downloader.Download() #Install updates. $Installer = New-Object -ComObject Microsoft.Update.Installer $Installer.Updates = … Continue reading Windows Updates Script

The Powershell pocket Active directory CMDLets

Computer object commands List all computer accounts in a domain Get-ADComputer –Filter {Name –Like "*"} View all computers that are logged in for 90 days to the Active Directory Search-ADaccount -AccountInactive -Timespan 90 -ComputersOnly OR $lastLogon = (get-date).adddays(-90).ToFileTime() Get-ADComputer -filter {lastLogonTimestamp -gt $lastLogon} Find and delete all disabled Computer accounts in Active Directory Search-ADAccount -AccountDisabled … Continue reading The Powershell pocket Active directory CMDLets