-
Ashish Roe and
Emanuel Halapciuc are now friends 5 months, 1 week ago
-
Emanuel Halapciuc commented on
Display the progress of long-running tasks in PowerShell with Show-Progress instead of Write-Progress 5 months, 1 week ago
Hi, Cyril.
Based on the question, I believe it should, yes. Just make sure you use the appropriate “percentage” for complete steps. -
Emanuel Halapciuc commented on
Display the progress of long-running tasks in PowerShell with Show-Progress instead of Write-Progress 5 months, 1 week ago
Hello, Cyril.
You don’t need to create additional loops, the function takes care of that.
Simply run Show-Progress -Total 10 and use something relevant for “percent complete”. RefreshInterval is just needed if you want to another interval for “refreshing” the progress bar display (the default is 1 second).
If you run Get-Help Show-Progress -Examples you can get an idea of how it works.Cheers! Emanuel
-
Emanuel Halapciuc commented on
Display the progress of long-running tasks in PowerShell with Show-Progress instead of Write-Progress 5 months, 2 weeks ago
Hi, Kerr. I wish I could take credit for that. 🙂
It’s not the case, but I’m quite happy my idea is somewhat similar to the way that smarter people thought to implement a nicer progress display in PS7.That one is more versatile and polished than mine, though. Mine is just a simple stop-gap until I move my client(s) to v7.x. It takes less screen space and looks a bit better than what’s in Windows PowerShell.
-
Emanuel Halapciuc liked the comment of KERR on Display the progress of long-running tasks in PowerShell with Show-Progress instead of Write-Progress. (So far, KERR has 1 likes for this comment) 5 months, 2 weeks ago
-
Emanuel Halapciuc commented on
If a Windows service hangs, restart the service with PowerShell 5 months, 2 weeks ago
Thanks for the heads-up, Anand.
Cheers! Emanuel -
Emanuel Halapciuc liked the comment of Anand Punjabi (Rank 1) on If a Windows service hangs, restart the service with PowerShell. (So far, Anand Punjabi (Rank 1) has 1 likes for this comment) 5 months, 2 weeks ago
-
Emanuel Halapciuc wrote a new post,
If a Windows service hangs, restart the service with PowerShell 5 months, 2 weeks ago
That a Windows service hangs (that is, becomes unresponsive or fails to stop) is a common issue admins face. With the help of PowerShell, you can easily restart a service. In this post, I also share my PowerShell script, which allows you to restart a hanging service on multiple computers.
-
Emanuel Halapciuc commented on
Format time and date output of PowerShell New-TimeSpan 6 months, 1 week ago
Hello, s31064 (wow, nice name, you could pretend to be one of Elon Musk’s children and claim inheritance money :D)
I’m glad you find this useful. Basically, i tried to make something that makes life easier. It’s a short one-liner once you’ve referenced the function, so my scripts look clearer.
I’m even happier when others find it useful, too.Cheers. Emanuel
-
Emanuel Halapciuc liked Use splatting and PSBoundParameters to pass parameters in PowerShell. (So far, This post has 1 likes) 6 months, 2 weeks ago
-
Emanuel Halapciuc commented on
Install, remove, list, and set default printer with PowerShell 6 months, 3 weeks ago
Hello again, Leos
The code in the article for setting a default printer (and also below) doesn’t need admin credentials.$Printer = Get-CimInstance -Class Win32_Printer -Filter “Name=’Adobe PDF'”
Invoke-CimMethod -InputObject $Printer -MethodName SetDefaultPrinterIf you haven’t blocked PowerShell for regular users, you could include this code as part of their logon script.
-
Emanuel Halapciuc commented on
Install, remove, list, and set default printer with PowerShell 6 months, 3 weeks ago
Hello, Leos.
I imagine you can, but it would invoke a bit more digging in the WMI. But it’s perfectly doable, Invoke-CimMethod has the switch -ComputerName which allows you to execute commands to remote computers.If it’s for a lot of users, you can still use Group Policy Preferences. Mike Kanakos has an excellent article here: https://4sysops.com/archives/deploying-printers-using-group-policy/
Cheers! EmanuelP.S. Many thanks for the appreciation.
-
Emanuel Halapciuc wrote a new post,
Install, remove, list, and set default printer with PowerShell 6 months, 3 weeks ago
With PowerShell, you can easily install a printer driver, add a printer to the repository, and then add a local or shared network printer to your Windows installation. In this post, I will also explain how you can list printers, add a printer port, set the default printer, and remove a printer with PowerShell.
-
Emanuel Halapciuc commented on
Format time and date output of PowerShell New-TimeSpan 6 months, 3 weeks ago
Hi, cK. I think I figured out where the mistake was, thanks to Oz Edri who pointed me in the right direction (see comment above). I hope it’s fine now for you.
-
Emanuel Halapciuc commented on
Format time and date output of PowerShell New-TimeSpan 6 months, 3 weeks ago
Hi, Oz Edri. Indeed, I didn’t think to always floor the “weeks” to a round number instead of leaving it as a round number. This meant that my function was always adding up a week when the time-span was n weeks and a half (wrongly displaying n+1 weeks). I’ve corrected it. Thanks for pointing it up, and apologies for the omission.
-
Emanuel Halapciuc commented on
Format time and date output of PowerShell New-TimeSpan 6 months, 3 weeks ago
Hi, cK. Can you please share an example where this didn’t work?
Cheers. Emanuel -
Emanuel Halapciuc wrote a new post,
Format time and date output of PowerShell New-TimeSpan 6 months, 3 weeks ago
My function, Get-TimespanPretty, allows you to view the time span—the difference between two time points or dates—in a compact, user-friendly format. It is built on top of the New-TimeSpan cmdlet, which offers details as output that you usually need. With Get-TimespanPretty, you can simply pipe the output (TimeSpan object) of New-TimeSpan or Measure-Command to Get-TimespanPretty. It’s easy to use, and there’s no need for complex reworking of scripts that may include such commands.
-
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 12 months ago
Hi, Joe.
Unfortunately, I know from experience the feeling of clients with old stuff. Win7 is not even the worst offender. If I throw a stick I’d easily hit a couple of Win2003 Servers. I don’t have to maintain them (nobody is maintaining them, actually), but fortunately they’re for some other project, (physically) disconnected from mine.
Anyway. The command should work in PS5.1 (or higher, if possible on Win7). I renamed a NIC to Local Area Network, and ran
[powershell]Get-NetAdapter | where InterfaceAlias -Like “Local*” | Format-List [/powershell]
and it worked fine.Name : Local Area Network
InterfaceDescription : Intel(R) Ethernet Connection (4) I219-LM
InterfaceIndex : 17 -
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 12 months ago
Hi, Joe. You could try to install PowerShell 5.1 on Windows 7. Then you should have the cmdlet available. I say “should”, because… I haven’t tested on Win7. To be honest, I try to keep away from older OSes as much as possible…
Some info is available here (including download links):
https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configureI hope this helps. Cheers!
-
Emanuel Halapciuc commented on
Change remote IP address and DNS entry with a PowerShell script 1 year ago
Well, I also introduced you to filtering. And I’d definitely use Where-Object instead of more convoluted syntax and arrays for that purpose.
Those are great tools and just as essential for other purposed, but not for this. I mentioned them here just to show there are more ways to accomplish something. And I also mentioned there are more ways, and that you should use the most suitable one for each case. 🙂 - Load More