windows 10
5 TopicsAverage CPU usage (%) over a few seconds
I'd like for a process to be monitored over a few seconds then be given its average CPU usage (% over that time). eg every seconds for 5 seconds, and I might end up stretching that as its CPU usage tend to be erratic. If possible the Windows 10 scripts will also work for 11. Thank you kindly for your solution or closely-related example scripts866Views0likes2CommentsWindows 10 Delete User Profiles Older Than 60 Days
Hi. I am working on trying to automate cleaning up local user profiles on some machines that after awhile run into HDD space issues. I've been working on a script below for this, but I cannot get it to work quite right. I want to leave any profile that does not have a creation date older than 30 days. But it still deletes all profiles in the C:\Users folder. It doesn't seem to recognize the CreationTime on the profile, even though I can visually verify the date is within 30 days. $Results = Get-CimInstance -Class Win32_UserProfile | Where-Object { $_.CreationTime -lt (Get-Date).AddDays(-30) -and $_.Name -ne "Public" -and $_.Name -ne "defaultuser0" -and $_.LocalPath -like "C:\Users\*"} Foreach ($Temp in $Results) { $temp | Remove-CimInstance Remove-Item -Path $temp.localpath -Recurse -force }61KViews0likes4CommentsPowershell Execute a specific method from an assembly
Hello, I'm trying to execute this script.ps1 in my vm of Windows 10 This variables gives me problems : $method= $class.GetMethod("runner") $method.Invoke(0, $null) It cannot call method value of null invalid operation runtime exception This is the code: $data = (New-Object System.Net.WebClient).DownloadData('http://10.10.10.10/lib.dll')$assem = [System.Reflection.Assembly]::Load($data)$class = $assem.GetType("ClassLibrary1.Class1")$method = $class.GetMethod("runner")$method.Invoke(0, $null) What can i do? ThanksSolved4.7KViews0likes2CommentsPowerShell script to open multiple websites in same browser on different tabs
I need to create a script that will open multiple websites, using IE in separate tabs, and also auto click the ok button on a agreement popup. I have found the following script that manages to open 2 of the 13 but it errors out and does not auto click the Ok button. $IE = new-object -ComObject "InternetExplorer.Application" $urls= gc "C:\Users\myname\Temp\url.txt" $count=1 foreach ($url in $urls){ if ($count -eq 1){ $IE.navigate($url,1) } else{ $IE.navigate($url,2048) } $count++ } Any assistance would be greatly appreciated.5.2KViews0likes0CommentsPowershell login passthough?
So I activated MFA for both of my accounts. One with my main company and one with my parent company. My problem is this, using MS Exchange Online Powershell, it autologins when I Connect-Exopssession -UserPrincipalName <my UPN here> for my main account which I don't really think is a good thing from a security standpoint (no user/password prompt, MFA etc.), and 2, when I put the UPN from the other tenant/domain in there, it fails with "Bad request for more information" after actually doing the MFA login. I had installed Microsoft Online Services Sign-In Assistant which I thought could be the culprit, but getting rid of it and restarting did not help. Any Ideas on how to stop this behavior and make me log in MFA every time instead of passthough and also why it might have broken logging into the other. Win 10 1709. Azure AD "Connected" not joined to main account, if that matters.4.2KViews0likes6Comments