Posts

Install Admin Pack on Remote Computer

Image
  Install-AdminPack Enable Admin Pack on Remote Computer with PowerShell By Michael J. Thomas There are many ways to get the job done but here is a solution to installing admin pack on a remote computer.  You may have other members of your IT team that need to have this installed on their computer but you don't want to get up and go to their computer. That is the magic of PowerShell Remote Administration.    $ComputerName = "RemoteComputer" Enter-PSSession -ComputerName $ComputerName #If there is a Group Policy blocking Windows Update then do this: Set-ItemProperty -Name "UseWUServer" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Value "0x00000000" -Type Dword  Restart-Service wuauserv Start-Sleep 2 #Register a Job to run this task for Installing Active Directory Tools $Name='Capability' Register-ScheduledJob -Name $name -ScriptBlock {Add-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS-LDS.Tools~~~~...

Add-RemoteDesktopUsers

Image
Add-RemoteDesktopUsers Add Remote Desktop Users to a Remote Computer with PowerShell By Michael J. Thomas If you are getting tired of adding users to remote computers the manual way for users to have RDP access to their computers. Then the following solution with our PowerShell automation will be a sigh of relief  from your manual labors.  Manual Process:  Open Computer Management  Click Action Menu  Click Connect to Another Computer Type Computer Name "Computer1" Click OK  Expand Down Local Users and Groups  Select Groups  Double Click Remote Desktop Users Group Click Add  Type the User Name "User1" Click OK Click OK again.  Automated Process with PowerShell: Open PowerShell Script and Run Type: Add-RemoteDesktopUsers -ComputerName "Computer1" -UserName -"User1"  <# .Synopsis    Add-RemoteDesktopUsers    Author: Michael J. Thomas    Updated: 01/16/2020 ...

How to use ValidateSet with Switch Statement

Image
How to use ValidateSet with Switch Statement By Michael J. Thomas Use validateset with a switch statement to put together more complex tasks. In the example below I use voicemail messages received from parents in which you can gather the information and then send out notifications to the teachers of the student status by copying the information to the clipboard and being able to paste it in the desired method of communication.  I did not include other code to show how to email this information or send it in another manner. I wanted to keep this simple to understand how to use a validateset with a switch statement in order to take advantage of implementing complex tasks with your functions. You can use this information and put together an on-boarding process for provisioning accounts and user roles. function New-Voicemail { param( [string]$Name, [ValidateSet(6,7,8)]$Grade, [ValidateSet("Tarde","Early","Absence")]$Reason ) $...

Mike's Profile Cleanup Tool

Image
Mike's Profile Cleanup Tool This excludes by default the system profile that is listed under special, the default user that is executing this program script. This PowerShell Script pulls a list of user profiles that you can select which ones you want to exclude and then clean the profiles. This tool is useful for those computers that have old profiles on it and the users no longer need them.  #Created by Michael J. Thomas #Created on 12/27/2019 #Updated on 12/28/2019 # Use at your own risk. We are not responsible for any lost of data. # Thomas IT Services. All Rights Reserved. (c) 2019-2020 $ErrorActionPreference = 0 Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.Application]::EnableVisualStyles() $Form = New-Object system.Windows.Forms.Form $Form.ClientSize = '446,256' $Form.text = "Mike'`s Profile Cleaner Tool - PowerShellWeekly.com" $Form.TopMost = $true $Form.StartPosition = "CenterScreen" $Form.FormBorderSt...

Set-ADPhoto

Image
Set-ADPhoto Set Active Directory Photo for Users By Michael J. Thomas I have been very busy lately, so I'm going to keep this one simple. How to set a photo for active directory user with PowerShell. The more built out version will be posted at a later time. function Set-ADPhoto { [ CmdletBinding ()] param( [ string ] $UserName , [ string ] $File ) $Photo =[ System.IO.File ]::ReadAllBytes( $File ) Set-ADUser $UserName -Replace @{thumbnailphoto= $Photo } }

Install-Fonts

Image
Install-Fonts Install Fonts on a Computer with PowerShell By Michael J. Thomas It has been a busy week for me and so I have not had much time write a script for this week. I started looking back at some of my old VBScripts and thought it would be fun to write a PowerShell version of Installing Fonts. I created a function called Install-Fonts.  It has two switch options with the current version of it. I have some more ideas I'm going to update this one soon but I'm limited on as of this writing. I hope you all enjoy this one for now. Select one file with the -File switch Install-Fonts -File "c:\Fonts\FontName.ttf" Select the whole folder with the -Files switch Install-Fonts -Files "c:\Fonts". Download Script from GitHub <# .Synopsis    Install-Fonts    Author: Michael J. Thomas    Created: 07/10/2019    Updated: 07/10/2019 .DESCRIPTION    Install Fonts on a computer. .EXAMPLE   ...

Invoke-Reprofile

Image
Invoke-Reprofile Fix Corrupted User's Profiles with PowerShell By Michael J. Thomas Troubleshooting a user's profile is sometimes hard to pin point out where the problem is and that is why a lot of us techs will use the technique of re-profiling the user's profile and copying just their data back. To do this process of re-profiling a user manually, I will demonstrate this process with a user account named Ed. I would do the following steps to fix his corrupted profile: Logoff Ed Login with an Admin Account Rename C:\Users\Ed to C:\Users\Ed.old  Edit the Registry HKLM:\Software\Microsoft\Windows NT\CurrentVersion\ProfileListNow\SID and find Ed's SID and rename it to the SID.old.  Logoff Admin Account Login Ed to Create a New Profile for him. Copy Ed's Data from Ed.Old Folder to his New User Profile. I automated the process by creating a PowerShell Script that can fix it remotely. The script renames the user's profile to user.old, backups the...