Powershell Remote desktop sessions

This is a quick made script in 1 line that performs a query to a given list of servers where remote desktop is enabled This is an alternative of using graphical mode on a broker I't can be upgraded next to identify session and log off the desired user ( future post ) The script … Continue reading Powershell Remote desktop sessions

Restore Windows 10 Store APP via Powershell

If you have lost you Windows10 Store , there is a quick fix that can bring it back. We will not require admin rights for this fix and is advisable to do it with user permissions as W10 apps mainly work via user context The first that we will do is search for our package … Continue reading Restore Windows 10 Store APP via Powershell

Set Ownership Script powershell

I have found on technet an interesting script for taking ownership of the folders here, many thanks to Boe Prox for this amazing function In my case I had to use the script as the company I work for decided to give "Full control" to the users on several folders and that induced a problem … Continue reading Set Ownership Script powershell

AD PowerShell Get all Security/ Distribution groups including email assigned

Script for quickly getting any security/distribution list group and if so, they have an email assigned ; #import-module activedirectory $user="Example" $array = Get-ADPrincipalGroupMembership $user | Get-ADGroup -Properties * | select name, description,mail,groupcategory echo "All DL groups and email groups for the user" foreach($i in $array.count){echo $array}

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