-
IT Consultant replied to the topic Create Folder based on CSV file with PowerShell in
PowerShell Forum 2 weeks, 1 day ago
with test-path is not working 🙁
$Names = Import-Csv -Delimiter "," -Path "$PSScriptRootInfo.csv" | Select-Object customer, info $Folders = Set-Location -Path "$PSScriptRootCollection" foreach($customer in $Names){ if (-not (Test-Path $Folders)) { New-Item -Path $Folders -Name ($($customer.customer)+" "+$($customer.info)) -ItemType Directory Write-Host -ForegroundColor Green "`tfolder $($client.client)" "$($client.cluster) created" } else { Write-Host -ForegroundColor White "`tfolder $($client.client)" "$($client.cluster) exist" } }
-
Leos Marek replied to the topic Create Folder based on CSV file in
PowerShell Forum 2 weeks, 1 day ago
Try Test-Path?
-
David Figueroa replied to the topic Export CSV to one Excel file with separate worksheets in
PowerShell Forum 2 weeks, 1 day ago
Well, I wouldn’t use the + signs to combine strings.. it’s slow.
$csvinfo = '{0} {1}_info.csv' -f $clients, $dateformat
There’s no reason you can’t just use _info.csv as the worksheet name, but not something that makes sense to me.
But if you wanted to split it..
-worksheetname ('-{0}' -f $csvinfo.split('_')[1])
The problem you’ll run into is you can only use a name once for a worksheet.. the others must have different names.
Coralon
-
David Figueroa replied to the topic Export CSV to one Excel file with separate worksheets in
PowerShell Forum 2 weeks, 1 day ago
Well, I wouldn’t use the + signs to combine strings.. it’s slow.
$csvinfo = '{0} {1}_info.csv' -f $clients, $dateformat
There’s no reason you can’t just use _info.csv as the worksheet name, but not something that makes sense to me.
But if you wanted to split it..
-worksheetname ('-{0}' -f $csvinfo.split('_')[1])
The problem you’ll run into is you can only use a name once for a worksheet.. the others must have different names.
Coralon
-
IT Consultant started the topic Create Folder based on CSV file with PowerShell in
PowerShell Forum 2 weeks, 2 days ago
I have a CSV file and I would like to create folders based on 2 columns from that CSV file.
$Folders = Import-Csv -Path ".data.csv" -Delimiter ";" | Select-Object info1, info2
I’m able to get info1 and info2 but not able to test if the folder already exists or not.
If not then the script should create it like this *info1 info2*
-
Paul Masek commented on
Using the Convert-EventLogRecord function alongside the Get-WinEvent PowerShell cmdlet to search Windows event logs 2 weeks, 3 days ago
Thanks Dimitri! I’m glad that I was helpful in your log analysis process!
-
IT Consultant replied to the topic Export CSV to one Excel file with separate worksheets in
PowerShell Forum 2 weeks, 4 days ago
Hi @figueroa2david
Thank you for your help it’s working 🙂I have another question 🙂
My CSV file is named like this :
$csvInfo = "$($clients)" + " " + $dateFormat + "_Info.csv"
Is there any way to split that name and just use “_Info.csv” as worksheetname?
-
Brandon Lee wrote a new post,
ScriptRunner Portal Edition R5—New Query configuration and Action configuration 2 weeks, 5 days ago
ScriptRunner provides a centralized management interface for PowerShell scripts, allowing users, even with little or no scripting experience, to automate IT tasks. The most recent release, ScriptRunner Portal Edition R5, introduces many new refinements to the platform, including the introduction of Query and Action configuration into the portal.
-
This code in case you need it !!
*Note: When I used Angle Bracket in your post do not show them property.
-File sharedfolderpathtofilePSTest.ps1THY.
-
Hello.. I am trying make work a .ps1 file (Pop-Up or Balloon Tip Notification from PowerShell) unsuccefully, any comment about it? or better said I think I do it work…….but do not show nothing on screen (remote device) (file tested ok in Both devices)
PSExec -s -i 3 -d -u cmd /c Powershell -ExecutionPolicy Bypass -File ‘\PSTest.ps1’
-Show cmd and closed inmediatly but no Pop-up any NotificationDo any comment ?
This code in case you needed !!
-
Hello.. I am trying make work a .ps1 file (Pop-Up or Balloon Tip Notification from PowerShell) unsuccefully, any comment about it? or better said I think I do it work…….but do not show nothing on screen (remote device) (file tested ok in Both devices)
PSExec -s -i 3 -d JA-LAP -u cmd /c Powershell -ExecutionPolicy Bypass -File ‘\PSTest.ps1’
-Show cmd and closed inmediatly but no Pop-up any NotificationDo any comment ?
-
The primary benefit to Resolve-DNSName compared to nslookup is that you’re getting an object back that you can process in your scripts without having to try and parse the text. You can retrieve the IPv4 & IPv6 addresses simultaneously, get the record types etc. It’s a very rich object that gets returned.
David F.
-
The idea of leaving LLMNR seems like a bad idea.
-
Honestly the biggest problem with Resolve-DnsName is how limited its availability is. Because it’s part of Windows PowerShell only, it’s not available on Server Core, Azure Cloud Shell / Function Apps etc or other operating systems.
It’s a useful cmdlet especially in a script, but it would be far more useful if I could depend on it to be available where I’m working.
-
You missed the entire point of my comment.
This article is not about running nslookup under PowerShell.
It is about a new PowerShell cmdlet in place of nslookup.I have zero interest in opening a PowerShell session just to run nslookup which I can do just as well with CMD, which is installed on EVERY version of Windows.
A number of PowerShell cmdlets are not available on WinXP or Win7 because the versions that contain them won’t run on those platforms.
I like PowerShell just fine, and write a great deal with it.
I still use nslookup because it is “always there” when I need it. -
I don’t know why you say PowerShell “orphans” nslookup. Nslookup is still available to use, and actually works very well from a PowerShell prompt as well as a CMD prompt. If you feel that PowerShell versions are not available on older platforms, I can only assume you never tried to install a newer version of PowerShell on those machines.
-
nslookup is available back to Windows XP.
This powershell applet is not.
Pity.Like so many other things “PowerShell” it orphans perfectly good functions such as nslookup because the new toys are bound to powershell versions not available on older platforms.
There are many valid reasons why older platforms remain in use.
-
Wolfgang Sommergut wrote a new post,
Resolve-DnsName: nslookup for PowerShell 4 weeks ago
nslookup has established itself as a popular tool for troubleshooting DNS problems. It exists on multiple platforms, including Windows. However, there is an alternative, the PowerShell Resolve-DnsName cmdlet, which can also check proprietary Microsoft protocols for name resolution, such as NetBIOS or LLMNR.
-
-
Windows is like a time machine, get on it and you’ll find yourself with the same problems of 30 years ago! Fresh paint coats don’t make it better, after the millennium hang over of the 90’s on windows, everything was modernized, even Microsoft Azure runs on Linux… but I just got a customer who did not FIX his code 30 years ago and is still stocked to the same windows primitive ways and above all, the licensing nightmares!
Yeah, they have a 30 GB windows monolith monstrosity and the words like microservices or containers are just alien stuff for them. I have resigned and moving back to the 21st century! - Load More