Sign in to join the PowerShell Group
James Horsley commented on
Map VMware virtual disks and Windows drive volumes with a PowerShell script 12 hours, 31 minutes ago
This was really helpful but came out with almost no matches for me initially – but I found that the $VirtualDiskDevice.Backing.Uuid was a 100% match for the $disks.SerialNumber – though format of the guid’s was a bit different – so needed to remove ‘-‘ from Uuid and then uppercase the to get the 100% match. This is like the holy grail for me as I have been trying to find a reliable way to find which vmdk to increase in size when a disk mounted through a mountpoint is short on space – on SQL servers I like each log and database to be on it’s on disk so loads of disks and really hard to match … until now! So thanks for the inspiration.
NItish TIwari commented on
Enable BitLocker with PowerShell 22 hours, 16 minutes ago
Can you tell if we have article for Azure-ad joined computer where we can save the key to AAD > devices?
Thank you VERY much! Your script will save me a lot of time and effort, and I really appreciate it.
For anyone else reading the comments, upgrading to Powershell v7 and using the SHA1 algorithm for hashing sped up my deduping by a HUGE margin. I think the first time I ran it it took over 7 minutes. But the with Powershell v7 and changing from MD hashing to SHA1 it was down to seconds – approx 30 seconds. That’s a huge improvement in speed.
How to set retention time while using write-s3object command in s3 client module?
You will find the answer to this question in this article.
This should work:
Get-ChildItem -Path “C:MyFiles” -Filter *.jpg -File -Recurse `
| Group -Property Length | where { $_.Count -gt 1 } `
| foreach { $_.Group } `
| Out-GridView -Title “Select files to move to R:Dupes” -PassThru `
| Move-Item -Destination “R:Dupes” -Force -VerboseThis is a great way to find duplicates. However, I have a significant number of small files (over 100,000) that I’m trying to scan. So for them, filesize is a good enough indicator to move them and investigate further. But I can’t seem to modify what you’ve got above to just use filesize. It finds the duplicates, and opens the selection window, but the move command fails because the Path is blank or null. What am I doing wrong?
Here’s my command:
Get-ChildItem -Path “C:MyFiles” -Filter *.jpg -File -Recurse `
| Group -Property Length | where { $_.Count -gt 1 } `
| foreach { $_.Group | select Path, Name, Length } `
| Out-GridView -Title “Select files to move to R:Dupes” -PassThru `
| Move-Item -Destination “R:Dupes” -Force -VerboseIs there a powershell command that can be pushed out for force the recovery key to be sync’ed with the computer account in AD? We currently use a script to activate bitlocker, set the PIN, require TPM and then push the recovery key to AD, but previously, it was all manually done and there are computers out in our environment that do not have their recovery keys in AD.
Wolfgang Sommergut wrote a new post 1 week, 1 day ago
Activate BitLocker with manage-bde, PowerShell, or WMI
You can configure various settings for BitLocker using group policies, but this doesn’t initiate encryption. Similarly, it doesn’t create the configured protectors that are necessary for activating BitLocker. Manage-bde, PowerShell, or the WMI class Win32_EncryptableVolume serve this purpose.
Sponsor posted an update in the group
PowerShell 1 week, 3 days ago
Managing Active Directory users and groups is one of the central, recurring tasks of IT administration.
For example, new users and groups have to be created, group memberships have to be managed or reports have to be generated.
In this webinar, we will show you how these tasks can be standardized, automated and delegated in a time-saving manner using PowerShell.
Register for freeDavid Figueroa commented on
Export and import to and from Excel with the PowerShell module ImportExcel 1 week, 6 days ago
Just import them like normal using the -StartRow parameter.
$Excel = Import-Excel -Path c:temptest.xlsx -StartRow 5
Neel commented on
Export and import to and from Excel with the PowerShell module ImportExcel 1 week, 6 days ago
Hi Sir,
Thank you for this tutorial. Please can you help me with deleting first 4 rows in xlsx while importing.
It should work just fine. The -ExecutionPolicy Bypass tell it to ignore the ExecutionPolicy. That’s why Microsoft stresses that ExecutionPolicy is -not- a security boundary.
David F.
OsyOsu posted an update in the group
PowerShell 2 weeks, 1 day ago
I would like to know how can notify all my users on my domain that their password will expire after 15 days, does someone knows how get it this issue solved ?
OsyOsu joined the group
PowerShell 2 weeks, 1 day ago
Michael Pietroforte commented on
Use PowerShell Invoke-Command to run scripts on remote computers 2 weeks, 1 day ago
Why does the filename start with a hyphen? Is that correct? Try running the script and just print $v on the screens to see if the computer names are processed correctly.
Facundo commented on
Use PowerShell Invoke-Command to run scripts on remote computers 2 weeks, 2 days ago
Hi I think my latest comment didn’t get posted.
If I run it like this I can run it for several computers :Invoke-Command -FilePath D:-facundoStart-Cleanup.ps1 -ComputerName computer1, computer2, computer3, etc
This will run without issue.
But when I try to set it with a variable ($VMs) and foreach and invoke It won’t work.Error:
New-PSSession: A positional parameter cannot be found that accepts argument ‘computername’Facundo commented on
Use PowerShell Invoke-Command to run scripts on remote computers 2 weeks, 2 days ago
Hi, Yes. I can even run for a couple if I run it like this
Invoke-Command -FilePath D:-facundoStart-Cleanup.ps1 -ComputerName Computer1, Computer2, Computer3, etc.
If I run it like that it will clean all computers after ComputerName without issue.
But when I try to add a variable for bulk computers and, use Invoke and foreach It doesn’t work.Error:
New-PSSession: A positional parameter cannot be found that accepts argument ‘computername’Michael Pietroforte commented on
Use PowerShell Invoke-Command to run scripts on remote computers 2 weeks, 2 days ago
Does it work if you run Invoke-Command for a single computer?
Facundo commented on
Use PowerShell Invoke-Command to run scripts on remote computers 2 weeks, 2 days ago
Hello. Thank you very much for the article. It is really helpful.
I wanted to ask you something. Perhaps you can help.
I have a ps1 file. A function.
I am trying to make it run against several remote computers. I am trying to use invoke-command to achieve this but it is not working.
This how I am trying to run it. Can you please tell me if this is OK or how you would run it?$VMS= get-content “D:-facundoVMS.txt”
foreach ($V in $VMS) {Invoke-Command -computername $v -FilePath D:-facundoStart-Cleanup.ps1}
- Load More
The easiest way is through a login script. You can have it read the registry values for expiration, compare it to the current time and then pop up a display or send them an email that their password is going to expire.
You can also put together an automation script that will scour AD for expiration dates, and email the users. You would have that version run as a scheduled task somewhere.
There are tools out there to automate this also, but if it is just simple notification, either of these will take care of it.
David F.