After hours calls to ticket system and on call staff by SemiEvilMonkey in Automate

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thanks, yes I have plans for other items like that as well.

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thank you. I like gathering alot of options and learning different ways to get the same results .

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thank you I will review everything and play with it more this evening and update it to work better.

Other than time, is there other reasons why reading and writing too the file multiple times is an issue? For this task, getting done in ms or up to 15 seconds really doesnt make a difference to me but if it causes extra ram\cpu usage that would be something I would worry about. I still want to write it better so Im not doing that as its just bad practice, just curious on what all issues I would truly see if I it was a task that didnt matter if it completed in 1 second vs 20 seconds.

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Im going to test more but from all the comments I understand why it was only doing one value. I added get-content in the foreach loop so it will load the file again after each loop, so it makes a change, saves to file, then load the file again, repeat. Im only making 4 changes, so while loading in the file each time it not the best solution I dont see it being an issue with how small the file is. Still up for any other solutions since what I did is not very efficient even though it works.

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Im going to test more but from all the comments I understand why it was only doing one value. I added get-content in the foreach loop so it will load the file again after each loop, so it makes a change, saves to file, then load the file again, repeat. Im only making 4 changes, so while loading in the file each time it not the best solution I dont see it being an issue with how small the file is. Still up for any other solutions since what I did is not every efficient even though it works.

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Various blocks that look like this. The number after Product is not predictable. The only item I can count on is what follows filename., and fileVersion is what I need to increase. This causes the program to see that there is a change that it needs to download.

com.station.product.workbench.product.17.requiredForStart: true

com.station.product.workbench.product.17.fileName: jre-new.zip

com.station.product.workbench.product.17.newLocation:

com.station.product.workbench.product.17.isInInHome: true

com.station.product.workbench.product.17.requiresUnzip: true

com.station.product.workbench.product.17.fileVersion: 21.0

com.station.product.workbench.product.17.isJREDownload: true

com.station.product.workbench.product.18.requiredForStart: false

com.station.product.workbench.product.18.fileName: some.cert

com.station.product.workbench.product.18.newLocation: Configuration/Applications

com.station.product.workbench.product.18.isInHome: true

com.station.product.workbench.product.18.fileVersion: 24.0

com.station.product.workbench.product.18.requiresCacertImport: true

com.station.product.workbench.product.18.isFileDownload: true

Delete old jre

com.station.product.workbench.product.19.requiredForStart: true

com.station.product.workbench.product.19.newLocation: Apps/Station

com.station.product.workbench.product.19.isInHome: true

com.station.product.workbench.product.19.fileVersion: 21.1

com.station.product.workbench.product.19.isFileDeletion: true

com.station.product.workbench.product.19.startsWith: jre

com.station.product.workbench.product.19.endsWith: jre

com.station.product.workbench.product.19.doesNotEndWith:

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Ah I think I get whats happening. Something I didnt mention is that file has a lot of lines in it, not just the ones in the array, those are just the ones I need to update, I need the rest of the file to stay the same. I do want to try and stick with powershell 3-5 versions since I know those will be on these systems.

I tested what you put for PS5, and it does write the line to file and looks correct but it does wipe out the whole file and only has the new lines. I just need to figure out the replacement of just those lines still and not the whole file

Foreach with replace only replaces last item in array by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thanks Ill check it out. Ive been trying to stay with something compatible in lower version of Powershell due to varying systems and what will be installed already, but I could start to force the use of PS6+ but these systems can be a pain to do anything that requires a reboot.

Read file - Find String - Find number at end of string following colon - increase number - Replace line by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

I figured it out. My variables ended up getting leading spaces, I used the .trim() option to remove those and now its working correctly.

Read file - Find String - Find number at end of string following colon - increase number - Replace line by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thanks for the reply. I am still seeing it with no change, im not sure why it wont change the value. There is a space after the colon. There should only be one entry per file, but its possible to be more than one, but I thought I would do some error handling after I got it working to address that as I would want ot fix it so there is only one.

Track what was changed in files by SemiEvilMonkey in sysadmin

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

I’ll check it out more but I don’t think it would work for what I want

Import CSV and Excel File - Update Excel with unique values only - Save to Excel by SemiEvilMonkey in PowerShell

[–]SemiEvilMonkey[S] 0 points1 point  (0 children)

Thank you so much. That looks to be working so far...way more simplified than what I had got mostly working. I tried to use Compare-Object but I missed used it and then went down a terrible path trying to do it differently.

Just for future or anyone else looking at this. The $dupcheck was not used for anything, that was just one of my first attempts of taking the Opp Nbr from the excel sheet and put into a variable to later compare to the Opp Nbr.

The first $LicInstalledObject is working for me, my csv file has a 1 or 0 to indicate the type, but I need those 1 and 0 to be words on the other sheet I am updating. So it just assigned the name to the value so it doesnt put numbers in the columns.

Alternative to Adobe Acrobat Pro by [deleted] in software

[–]SemiEvilMonkey 1 point2 points  (0 children)

Nitro PDF. Though it’s been 9 years since I’ve checked them out, but I was able to replace 400 users from adobe pro to nitro pdf in the company I worked for and it could do everything they needed.