@sponsor
-
nooneoneno commented on
Fast event log search in PowerShell with the FilterHashtable parameter 16 hours, 7 minutes ago
Thanks a lot for this article, helped me for my purpose.
-
It seems you encountered a typical ChatGPT hallucination because the /b switch stands for “backup mode” and not “binary mode.” Check out the robocopy documentation.
-
I just was playing aroung with ChatGPT and asked how to preserve NTFS hardlinks when copying files from one drive to another. The answer was that the option /B of robocopy “causes the files to be copied in binary mode, so all attributes and properties, including hardlinks, are preserved.” I never used the option /B.
It would be great if you could you say something about this option. -
Some programs do change few bytes in files without altering the timestamps.
Microsoft Office did so (or still does?) in files of the old DOC, XLS, PPT format. As I remember, it was enough to open and close the files to see the changes. -
Just noticed the angle brackets got deleted from my post.. but it looks like we had the same thoughts..
machinename and the full path to the .ps1 file.
PSExec is going to start in System32 by default if I remember correctly.
David F.
-
Julio – there’s no need to call cmd from your psexec. Also, you’re trying to run two contradictory switches: -i (interactive) and -d (non-interactive).. that’s more than likely going to fail.
try it like this:
psexec -s -i 3 -h powershell -executionpolicy bypass -file pstest.ps1The pstest.ps1 file has to be local to the system (the system account can’t access network resources).
David F.
-
Hi, I was playing with the terminal and got stuck in the admin mode that you mentioned in one paragraph. How can I disabled the terminal to open always as admin using the JSON?
-
Javed Bukhari commented on
PowerShell loops: For, Foreach, While, Do-Until, Continue, Break 6 days, 11 hours ago
looking for a way to break the loop with “Return Key” Space or any other key.
-
Surender Kumar commented on
Create and manage custom AD attributes with PowerShell 1 week, 2 days ago
The -OtherAttributes parameter should work; Make sure you are using the hashtable format correctly.
-
hi Surender, how can we create a new user with a custom attribute?
lets say we want to create a new user with a custom attribute called “PersonalEmail” what parameter we should add newADUser command? “OtherAttributes” didnt work
thank you -
IT Consultant replied to the topic Create Folder based on CSV file with PowerShell in
PowerShell Forum 1 week, 2 days ago
Thank you 🙂
I didn’t express myself correctly, I’m sorry.
the CSV folder is created for each customer as it will contain additional data.
My basic CSV file includes key information on all customers.
for instance, each client file must have subdirectories named, [CSV], [Excel], [HTML]…etc.for sure if the subdirectorie if it’s already created it should not be created again 🙂
-
David Figueroa replied to the topic Create Folder based on CSV file with PowerShell in
PowerShell Forum 1 week, 2 days ago
-f is the format operator, and it has numerous sub-functions. But, the primary one we’re using here is to substitute various placeholders ( {0}, {1}, {2}) etc. with supplied values.
“{0} is a {1}” -f ‘This’, ‘test’ will print out This is a test.
As far as creating folders from your supplied CSV, it might be something like:
foreach ($customer in $csv) { new-Item -Path C:Customers -Name ( '{0}-CSV-Excel' -f $Customer.Customer) -ItemType Directory }
Coralon
-
IT Consultant replied to the topic Create Folder based on CSV file with PowerShell in
PowerShell Forum 1 week, 4 days ago
First of all, I would like to thank you very much, because not only is the problem solved, but I learned from these few lines, Thank you.
I know those two values are tied to $Customer.Customer, $Customer.Info, and besides this allowed me to go further and it allowed me to identify errors in my CSV by adding more values.
The parameter “- f” I did not understand what it corresponds to:).
I would like to take advantage of your level and experience and I wanted to have your opinion to add folders “- CSV- EXCEL-…” for each client what is the best way to proceed?
-
Greg McCullough commented on
How to map a network drive with PowerShell 1 week, 4 days ago
What if you want to label the mapped drive and not have the UNC remote path displayed?
I’ve actually found the Intune mapped drive generator website work best. It also supports Azure Files and item level targeting via SGs. Just input your desired drive letter, path URI or UNC, label or name, and the security group. Otis the PS1 file for you to download.
-
Wolfgang Sommergut wrote a new post,
How to map a network drive with PowerShell 1 week, 5 days ago
If you want to assign a drive letter to file shares via the command line, you can use PowerShell instead of net.exe. The SmbShare module’s cmdlets can display, connect, and disconnect shared drives. PowerShell also supports newer SMB features, such as QUIC and Compression.
-
Sponsor posted an update in the group
PowerShell 1 week, 6 days ago
PowerShell not only is a great technology to automate recurring tasks for IT Pros. Together with ScriptRunner it becomes the foundation for implementing all kinds of self-services for IT admins, help desk teams and line-of-business end-users. In this webinar we will cover use cases like “User password reset”, “Out-of-Office management” and “VM creation”.
Register for free -
Michael Pietroforte commented on
How to install the PowerShell Active Directory module 1 week, 6 days ago
Well, doesn’t this apply to all Microsoft products? Windows installs a LOT more than required, say evil tongues. 😉
But I think you can just install the RSAT tools that you need. For instance, to only install the AD management tools, you can run this command:
Add-WindowsCapability –online –Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
More info here
-
Hi Michael
The PowerShell command that you have listed for installing the RSAT tools on Windows 11 appears to install a LOT more than what is required, –Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability -Online
looks like it gets every available option starting with RSAT and then pipes them all to be added. There are lots of them, and according to the more ‘clicky’ version above it, it could be modified to just install the required ‘lightweight’ option. Is this right, or am I missing something? Thanks!
-
This may be a bit off scope but I was wondering if scripts like these could be make to use in Windows Task Scheduler? I ask because I have a password expiration reminder PS Script that I am trying to get to work in Task Scheduler but something tells me I might not be able to do it with a Gmail account that is set up for 2-factor authentication. I looked into the app password setting but I find that a bit confusing.
Any suggestions would be much appreciated.
-
David Figueroa replied to the topic Create Folder based on CSV file in
PowerShell Forum 2 weeks ago
Like I mentioned on the other post, you should not get into the habit of using + to join strings.. it’s inefficient, and in the wrong circumstance can cause massive performance problems. The format operator is much better.
It would help a lot to provide the CSV layout, but this is mostly a guess.
$Names = Import-Csv -Path “$PSScriptRootInfo.csv” | Select-Object customer, info # comma is the default delimiter, it does not need to be specified
Set-Location -Path "$PSScriptRootCollection"
foreach($customer in $Names) {
$CustomerPath = '{0}{1}' -f $Customer.customer, $Customer.Info
if (Test-Path -Path .$CustomerPath) {
$Message = '{0}{1} {2} exists' -f "`t", $Customer.Client, $Customer.Info
Write-Message -Message $Message -ForegroundColor Green
}
else {
$null = mkdir $CustomerPath
$Message = '{0}{1} {2} created' -f "`t", $Customer.Client, $Customer.Info
Write-Host -Message $Message -ForegroundColor Green
}
}
- Load More