Check if a program is installed and report version to a text file
In this example it checks for chrome $Hostname = hostname $user = whoami $time = Get-Date -Format ddmmHHmm $Program = Get-Package -ProviderName Programs -IncludeWindowsInstaller ‘*Chrome*’ | select Name,Version New-Item -path “\\Server\Share” -Name “Chrome$Hostname.txt” -ItemType “file” -Value “$Hostname,$user,$Program,$time” output file Chromews03.text Content WS03,azuread\mattl,@{Name=Google Chrome; Version=88.0.4324.146},06021702
Reset password on activate directory via powershell
Single user Set-ADAccountPassword –Identity useralias–Reset –NewPassword (ConvertTo-SecureString -AsPlainText “Newp@ssw0rd” -Force) Multiple Users csv with heading SamaccountName and the new password $UserFile = “C:\Temp\MultiUser.CSV” Foreach ($User in $UserFile) { $SamAccountName = $User .SamAccountName $ThisPassword = $User .Password Set-ADAccountPassword –Identity $SamAccountName –Reset –NewPassword (ConvertTo-SecureString -AsPlainText “$Password” -Force) }
Move Chrome data location to another location using mklink
You could do it be creating a symbolic link from the original default location (C:/Users//AppData/Local/Google/Chrome/User Data) to, for example, a “D:/chrome.userData” folder. You’ll need to: – close Chrome; – know your Windows login user name (“user” in the example); – decide to where you want to move the files. The steps are: – create the […]
Set out of office reply on multiple mailboxes
Set same on Mulitple CSV with Heading UserPrincipalName Txt file with the HTML Code for the reply Connected to Exchange via powershell This sets External message the internal message is set blank $Extmessage = Get-content -Path C:\Temp\externalmessage.txt Import-Csv C:\temp\Mailboxes.csv | ForEach-Object { $user1 = $_.”UserPrincipalName” Set-MailboxAutoReplyConfiguration -identity $user1 –AutoReplyState Enabled –InternalMessage ” –ExternalMessage “$Extmessage” […]
Changing the MTU size in Windows
Command prompt as admin netsh interface ipv4 show subinterface netsh interface ipv4 set subinterface “Local Area Connection” mtu=1400 store=persistent restart pc
Using PowerShell to Test a Remote Connection
Test-NetConnection www.google.com ComputerName : www.google.com RemoteAddress : 216.58.204.228 InterfaceAlias : Ethernet 3 SourceAddress : 192.168.0.13 PingSucceeded : True PingReplyDetails (RTT) : 17 ms Test-NetConnection www.google.com -Port 80 ComputerName : www.google.com RemoteAddress : 216.58.204.228 RemotePort : 80 InterfaceAlias : Ethernet 3 SourceAddress : 192.168.0.13 TcpTestSucceeded : True Test-NetConnection www.google.com -TraceRoute ComputerName : www.google.com RemoteAddress […]
Clear DNS Windows MacOS Linux
Windows CMD as admin ipconfig /flushdns MacOS Applications> Utilities > Terminal 10.7, 10.8, and 10.9 10.10.4 and above – sudo killall -HUP mDNSResponder 10.10.1, 10.10.2, and 10.10.3 – sudo discoveryutil mdnsflushcache 10.5 and 10.6 – sudo dscacheutil -flushcache Enter mac login password (requires admin) Linux Check if service is running – sudo systemctl […]
Bulk update VHD Location on Hyper-V Host
used for is you have already moved the files, for instance I updated from using the computer name \\storage\ to the FQDN get Excel file get-VMHardDiskDrive -VMName * | select VMName,ControllerType,ControllerNumber,ControllerLocation,Path | Export-Csv -Delimiter “;” -Path “c:\temp\vmvhdloc.csv” In excel file update path to what you want it to be (note this does not move […]
Virtual disk does not mount after restarting server
Either when you reinstall OS or add a new drive it seems to of disabled auto mount Confirm you have read/write access on the server you on Server Manager->File and Storage Services->Volumes->Storage Pools Right-click storage pool and choose “Set Read-Write access” and OK on the prompt Set drive to automatically mount in powershell Get-VirtualDisk | […]
Delete folder via CMD on Windows
run command prompt as admin cd to the location of folder DEL /F/Q/S *.* > NUL (this deletes all files all the folder structure) used cd.. to navigate to parent folder RMDIR /Q/S foldername (this deletes the folder and all subfolders) DEL /F/Q/S *.* > NUL /F — forces the deletion of read-only files. /Q — enables quiet […]