How can I make any errors thrown go thru the else part of my condition?

Advertisements Given: PowerShell 5.1 I’m getting an "Access denied" for some of the the computers in the array. How can make any errors run through the "else" part of condition where it’s NOT running? Right now, it’s just throwing entire error message and I don’t want the user to see all that. Invoke-Command -ComputerName $computers… Read More How can I make any errors thrown go thru the else part of my condition?

How to split csv and add additional column using PowerShell

Advertisements I have a csv file and it have multiple columns. I have a specific column name called "Exported_Id" and it look something like this f36b9decc73e40bfb9a6250198a83fc0/SharePoint/source_28D4CE4DFC53AABB34B41E17BE9DEBBC/item__6761c90b-c1e0-4a91-b72c-e044e5b8cc56_1.0 I’m just wondering how can I split to only this (Spliting before and after _ ) 6761c90b-c1e0-4a91-b72c-e044e5b8cc56 and then add it to a new column call "Modified_Id" and export… Read More How to split csv and add additional column using PowerShell

powershell copy files into remote machine issue using Copy_Item cmdlet

Advertisements I was trying to copy few files into my remote box, but i see the path format is not correct issue, can someone chekc this? for($hostname in Get-Content C:\folder1\machine.txt){ Copy-Item -Path "C:\folder1\ramen-0.1-web-1.3.6.jar" -Destination "\\hostname\C:\folder1\folder2\" -Recurse -Force } Error Message is: Copy-Item : The given path’s format is not supported. >Solution : Your missing ‘$’… Read More powershell copy files into remote machine issue using Copy_Item cmdlet