Sign in to join the PowerShell Group
Slava Rubin commented on Enable BitLocker with PowerShell 1 day, 19 hours ago
Hello Surender Kumar.
I was wonder if you can give me an advise or point to the correct search material.
I can not seem to be able to figure out how to get TMP to trigger Pin request on boot.
All machines in our company are part of AD.
I use NinjaRMM to execute power shell scripts remotely.
Checkpoint Endpoint Security to trigger BitLocker encryption process on deployment.
Unfortunately, I was recently tasked with helping my boss to let go of one of our employees next week.
The issue I got stuck with is he is a developer and remote. The only way I found that I can/should lock him out of the machine is by sending PowerShell script to enable Pin request on boot. Then just restart the machine.
I am not that good with PowerShell and BitLocker TPM process.
I can not seem to figure out how to trigger it.
Setting the Pin by open
Any help would be greatly appreciated.
To be honest, I don’t remember when I was doing this at all lol.
I will have to go revisit that as soon as I can. 🙂
Kirill Nikolaev commented on How to create a file share PowerShell repository 2 days, 5 hours ago
Hi David! Do you have .NET SDK installed? If not, that might be your problem. .NET SDK has a “pack” command which PowerShellGet uses to create packages.
The code i wrote is a function which means you have to load it into memory first or add it to your profile so it is autoloaded when you start your powershell prompt.
to load the function:
[powershell]. (path to file)backup-grouppolicy.ps1 [/powershell]
Notice the extra dot in the front of the line. You can also lookup dot-sourcing for a full explainer.
then the cmdlet Backup-GroupPolicy will be avilable to use like any other cmdlet.
I am trying to use this script, but it’s just doing “nothing” when I run it.
PS C:Scripts> .Backup-GroupPolicy -Path “C:ScriptsGPO_BUs” -Server DC
Any insight on this?
But there’s a huge difference between professional programmers and scripting admins. Script writers aren’t always looking at idempotency. And as one of the scripting admins.. if I’m doing something that starts deleting things, I do put in lots of checks, and force error checking.
But, bad script design is bad script design 🙂
Sumit Sengupta commented on Azure PowerShell vs. Azure CLI 5 days, 6 hours ago
Good article, nicely written. Another similarity is that from azure portal, one can launch a cloud shell in either of these two environments.
There is a reason that proper programming languages do not have the concept of non-terminating errors: it leads to unforeseeable results too often. Because errors tend to occur where nobody is expecting them.
During 20 years of development and administration, I have met only about a handful of edge-cases where I actually used an empty catch-block (and commented the reason).
But I have seen a gazillion scripts ignoring errors and causing real damage afterwards. E.g. one of those scripts had the task of cleaning up a directory. The dev ignored errors, since the script could encounter files in use and should just leave them. But one time it failed in determining the path itself and continued with $null as a value. The developer did not expect issues there. But now, his script deleted everything in the default-path, which was the user’s home-folder.
A very good practice in software development (aside from gaming) is to fail as early as possible. This applies to script development as well.
And if a developer does really have one of the edge-cases at his hands, where he wants to continue, he can always decide to do so by using an empty catch-block. But this should only be done after careful consideration and not as default-behaviour.
Ignoring errors by default was just a stupid decision by MS.
I would respectively disagree – it’s always a matter of perspective and usage. Depending on the script, setting ErrorActionPreference to Stop can absolutely cause all kinds of noise, bloated problems.
However, for troubleshooting purposes, sometimes it does help to set EA to Stop.. it’s very circumstantial.
Timothy Warner wrote a new post, Azure PowerShell vs. Azure CLI 5 days, 18 hours ago
In your work in Microsoft Azure, should you focus your energies on Azure PowerShell, Azure CLI, or both? This lesson presents a comprehensive comparison of the two primary scripting languages in the Azure cloud.
Pretty useful for writing PowerShell scripts.
That is really great stuff! I’ve always missed $string.right(n) $string.left(n) -This just about makes up for it
Wolfgang Sommergut wrote a new post, Trim characters from strings in PowerShell 6 days, 17 hours ago
Most programming languages provide string functions that can be used to selectively truncate leading or trailing characters. String objects in PowerShell have three such trim() methods that remove not only spaces but also any characters at the beginning and end.
You should always set the $ErrorActionPreference to “Stop”.
The distinction between non-terminating and terminating errors is the source of very many errors on itself. Because in almost all cases, the script is in an unexpected state after an error: the developer just does not remember to check for all possible errors. And letting software run in a state that the developer did not expect is always a bad idea.
I have seen this happen very often: some batch encounters an error and just keeps doing “something”. The work to clean up this mess is almost always much worse than having a clear error in the first place.
Symon Michael replied to the topic Import and export from Excel with PowerShell in PowerShell Forum 1 week, 4 days ago
Very handy to have – they are increasing the amount of required reporting at work, so this could be a real time-saver. Thanks! –S.
Mario commented on Robocopy examples 1 week, 6 days ago
Can anyone provide me with a script to move my files from my NAS File Server Storage Location directly to my External USB connected drive without interference.
Yeah bad comparison. The only parallel is that both sites are getting somewhat emotional when the topic comes up. I guess with VR / 3D GUIs and AI that writes code we will soon get into the next round.
If you were in Australia it would be the opposite. Being a royalist is seriously on the nose. In fact I think GUI’s are far more palatable than royalists.
Michael Pietroforte replied to the topic Import and export from Excel with PowerShell in PowerShell Forum 2 weeks, 4 days ago
You can learn how to import and export from and to Excel with PowerShell here.
bazz started the topic Import and export from Excel with PowerShell in PowerShell Forum 2 weeks, 4 days ago
I’m pretty new to using PowerShell with Excel, so i was trying to save the results. Probably really easy but I couldn’t find the answer online.
Import-Excel C:UsersadminDesktoptest123.xlsx -WorksheetName Blad1 -ImportColumns @(1, 2, 4, 5) -startrow 1 -endrow 7 Export-Excel C:tempoutput.txt
- Load More