Script working but need help tweaking

Add-pssnapin VMware.VimAutomation.Core

# Set the user name and password
$cred = get-VICredentialStoreItem - e:\powershell\cred2 file


# Configuration connecting to VIServer
to connect-VIServer-Server $cred. Home - user $cred. Username-password $cred. Password

# Set the Date time and name of the file
$date = get-date
$datefile = get-date - uformat ' %m-%d - %Y '
$filename = "E:\Powershell\Stage_patching_list_" + $datefile + ".csv".

# Create list of servers to patch
$report = @)
Get-file DOSSIER0, Folder1, Folder2, Folder3. Get - VM | %{
$vm = $_ | Get-View
$row = "" | Select name, State, status, host, CPU_Allocated, RAM_Allocated, LastReboot, LastPatchApplied, restarted, questions
$row. Name = $_. Name
$row. State = $_. PowerState
$row. Status = $vm. Summary.OverallStatus
$row. Host = $_. VMHost
$row. CPU_Allocated = $_.numcpu
$row. RAM_Allocated = $_.memorymb
$LastBoot = [System.Management.ManagementDateTimeConverter]: ToDmtfDateTime ((get-WmiObject win32_operatingsystem-ComputerName $row..)) LastBootupTime name))
$row. LastReboot = $LastBoot
$LastPatch = get-WmiObject Win32_QuickFixEngineering - ComputerName $row. Name |? { $_. InstalledOn} | Sort installedon | Select - last # 1 | FT hotfixid, installedon
$row. LastPatchApplied = $LastPatch
$row. Restarted = "YES/NO".
$row. Questions = "YES/NO".
$report += $row
}

# End of the Session on the server
disconnect-viserver-confirm: $false

# Creat file separated from Coma
$report | Export-Csv $filename - NoType-Force

# Create the e-mail message
$server = "mail.xata.com".
$port = 25
$to = 'somebody @somewhere.com'.
$from = Server@somewhere.com
$subject = "list of servers to patch of scene.
$body = "If you please see the attached file. TEXT TEXT TEXT TEXT.
$message = New-Object system.net.mail.MailMessage $from, $to, $subject, $body

# Create SMTP client
$client = New-Object system.Net.Mail.SmtpClient $server, $port

# Try to send the message
try {}
$message. IsBodyHTML = $true
$attachment = new-object Net.Mail.Attachment ($filename)
$message.attachments.add ($attachment)

# Send message
$client. Send ($message)
}

# Catch failed message
catch {}
"Exception caught in CreateTestMessage1():
}

The script works when I run it manually (comment out the snap) but I see errors of authentication on the cli. Especially the "Get-WmiObject: access denied." (Exception from HRESULT: 0 x 80070005 (REFUSAL of E_ACCESS)) "error. However the CSV fills all information as if there was no error at all. We would like to have this race on a scheduler for our patch dates. I wonder if the mistakes that showup in powerCLI will prevent a scheduled task to complete? Also is there a way to fix those problems, we run the script as a user with local administrative privileges on the servers the script controls. I tried - authentication 6 - enableallprivaleges and a crowd of other google answers. None of them have corrected the problem. However its confusing that it always returns the correct information.

Is there a better way to do it? Is there a cleaner way to encode the script? Is last question possible to change the output of "Get-WmiObject Win32_QuickFixEngineering. - ComputerName $row Name |? { $_. InstalledOn} | Sort installedon | Select - last # 1 | "" hotfixid ft, installedon ' of '.

\\Server\root\cimv2:Win32_QuickFixEngineering.HotFixID="KB2624667",ServicePackInEffect="SP3"to something a bit more readable like "Latest Patch = KB2624667"? We don't need the service pack information.

I've tinkered with that many other scripts into a workable script that does what we want, I wonder if there is a way to clean. Thanks for looking and taking the time to answer.

I dug a little deeper, and it seems that the InstalledOn property is different on a Windows 2008 host compared to a Windows 2003 or Windows 2008 R2 host.

This led me to the following code.

# Create Server List for Patching $report = @()
foreach($vm in Get-VM){
    $row = "" | Select Name, State, Status, Host, CPU_Allocated, RAM_Allocated, LastReboot, LastPatchApplied, LastPatchDate, Rebooted, Issues
    $row.Name = $vm.Name
    $row.State = $vm.PowerState
    $row.Status = $vm.ExtensionData.Summary.OverallStatus
    $row.Host = $vm.VMHost
    $row.CPU_Allocated = $vm.numcpu
    $row.RAM_Allocated = $vm.memorymb
    $row.LastReboot = [System.Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject win32_operatingsystem -cn $row.Name).lastbootuptime)
    $lastPatch = Get-WMIObject Win32_QuickFixEngineering -ComputerName $row.Name |
        where {($_.psBase.properties["InstalledOn"].Value).Length -gt 0} |
        Sort-Object -Property {
            if($vm.Guest.GuestId -eq "WinLonghornGuest"){
                $_.InstalledOn
            }else{
                [datetime]($_.psbase.Properties["InstalledOn"].Value)
            }
        } |
        Select -Last 1    $row.LastPatchApplied = $lastPatch.HotfixId
    if($vm.Guest.GuestId -eq "WinLonghornGuest"){
        $row.LastPatchDate = $lastPatch.InstalledOn
    }
    else{
        $row.LastPatchDate = $lastPatch.psbase.Properties["InstalledOn"].Value
    }
    $row.Rebooted = "YES/NO"    $row.Issues = "YES/NO"    $report += $row}
$report # End the Session on the Server

If it is a Windows 2008 Server, the date is there in clear text for Windows 2003 and Windows 2008 R2, to use the trick of PSBase.

On the Sort-Object, I use a codeblock to set the sort value, and in there, I can test what OS we are dealing with.

In the same way I fill the $row. Property of LastPatchDate.

Tags: VMware

Similar Questions

  • I have a problem, try to uninstall the ask toolbar. get the error message: cannot access the VB script... need help please

    I have a problem, try to uninstall the ask toolbar. get the error message: unable to access the VB script... need help

    Hello

    How do you try to uninstall the toolbar?

    I would suggest trying the following methods and check if it helps.

    Method 1:

    Try the steps in the following Microsoft article and check if it helps.

    How to fix script errors in Internet Explorer on Windows computers:

    http://support.Microsoft.com/kb/308260

    Correction of errors in Internet Explorer: http://support.microsoft.com/kb/822521

    Method 2:

    Try to uninstall the toolbar, programs and features and check if it helps.

    Uninstall or change a program:

    http://Windows.Microsoft.com/en-us/Windows-Vista/uninstall-or-change-a-program

    Hope the information is useful.

  • Hi, I have installed sqldeveloper - 4.0.3.16.84 - x 64 with JDK and tried to run SQLDeveloper.exe its does not work. A flash comes and goes. It worked fine until two days ago. Don't know what happened all of a sudden its not working. Need help.

    Hi, I have installed sqldeveloper - 4.0.3.16.84 - x 64 with JDK and tried to run SQLDeveloper.exe its does not work. A flash comes and goes. It worked fine until two days ago. Don't know what happened all of a sudden its not working. Need help.

    I use Windows 7 Pro.

    I have read other threads and tried to launch SQLDeveloper.exe from the CMD prompt, nothing is shown a flash comes and goes.

    Tried to change of SetJavaHome sqldeveloper.conf to the path JDK that it didn't work.

    Please guide me.

    Thank you

    Maybe there is a problem with SQL Developer, being able to write to the network share of desktop directory.  Add the following to your sqldeveloper.conf file to force the settings of the user to store locally also:

    AddVMOption - Dide.user.dir = some_local_dir_to_own_system4.0.3.16.84

    I hope this helps...

  • So close but need help to compare strings in different subforms with loop - Livecycle ARE for

    For some reason, I wasn't able to do this post in the forum of Livecycle ES, even though I posted it there often in the past.

    I've created a form that I almost work and I hope that someone can help me.

    We have eight teams billing in our society and each team works anywhere from 1 to 4 different clients. The form is used to track, by the representative of billing, the number of shipments that every billing r5ep works every day. What I need to add at the bottom is a subform that performs the totals by customer. So, I try to get the form to loop through all existing subforms (and subforms in their breast) and compare a cell in the subform from bottom for a cell in other subforms, which are added dynamically, and then total ONLY items. My script does not work however.

    What I have now is:

    var repCount is form1. P1._rep. Count

    var itemCount is form1. P1. Rep._ItemSet.count

    for (x = 0; x < repCount; x ++)

    {

    for (i = 0; i < itemCount; i ++)

    {

    If (clientName.rawValue is P1.rep [x]. ItemSet [i].client.rawValue)

    {

    this.rawValue is this.rawValue + P1.rep [x]. Itemset [i].corresp.rawValue;

    }

    }

    }

    It seems like it should work, but I get the following error:

    P1. Rep [x] is undefined


    So what it looks like, is that miss me is the right way to reference objects in these subforms.

    Form is here: https://Acrobat.com/#d=20gWXZ4sBm4OPV6oO76zSg

    If someone could take a look, I would be very grateful.

    Thank you

    JO

    I don't know anyone else will ever I had a similar problem, but I thought I would go ahead and post the solution, just in case...

    The error I received (P1.resolveNode ("rep [" + j + "].")) (("Set [' + i + '"] ') is nothing) was occurring because the variable itemCount needed to be referenced in the repCount of loops. I also need to resolve the node for itemCount, that I was not doing.

    So... my old code was this:

    var repCount = P1._rep.count;

    var itemCount = P1.rep._ItemSet.count;   //this part threw the error. Use resolveNode... and should not declare the variable until, within the first loop of For.

    nTotal var = 0;

    for (var j = 0; j)

    for (var i = 0; i)

    If (P1.resolveNode ("rep [" + j + "].")) ("Set [" + i + "]"). client.rawValue == clientName.rawValue) {}

    nTotal = nTotal + P1.resolveNode ("rep [" + j + "].") ("Set [" + i + "]"). corresp.rawValue;

    }

    }

    }

    this.rawValue = nTotal;

    .. .who wasn't because he was trying County of itemset right up front... goal, it was expected that within the first iteration of subfields repCount reference... AND that it was necessary to have used resolveNode.

    The corrected code is:

    var repCount = P1._rep.count;

    this.rawValue = 0;

    for (var j = 0; j)

    var itemCount = P1.resolveNode("rep["+j+"]")._ItemSet.count;  //corrected code... node is resolved and the variable is declared in the first subform repCount.

    for (var i = 0; i)

    If (P1.resolveNode ("rep [" + j + "].")) ("Set [" + i + "]"). client.rawValue == clientName.rawValue) {}

    this.rawValue = this.rawValue + P1.resolveNode ("rep [" + j + "].") ("Set [" + i + "]"). corresp.rawValue;

    }

    }

    }

    .. who works now perfectly... and I throw a party to celebrate! Laughing out loud

    JO

  • Fs9 not opening - identified problem but need help repair

    I want to thank you in advance for your time. I am trying to install and play flight sim 2004 on windows 7 - a x 64 sys - and when I open fs9.exe splash screen or anything really fails to display.

    I think that is the problem, is that there is no record of FS9, under the %appdata%\Windows\ that basically, I need help trying to solve. Is there anything I can download to replace this file? Or am I just looking in the wrong place.

    Also, I installed it in a different directory, not the directory Program Files (x 86) but rather just C:\FlightSim\

    Hi Jordan,.

    The game does not appear to be installed according to the description of your problem.

    I suggest you log in as administrator or right click on fs9.exe file and run as administrator.

    I think that this is precisely the reason why the FS9 folder does not appear in c:\users\explore \appdata\local\Microsoft\windows\game.

    If this does not work, I suggest that you look into other aspects as well. Follow the steps below.

    Method 1:

    Update display drivers . The flash on the screen could also be because the display drivers are not updated. I would recommend you visit the manufacturer, download and install the latest display drivers for windows 7.

    Method 2:

    I suggest to disable UAC and then try to install the game.

    Note: User Account Control (UAC) can help prevent your computer from unauthorized changes. UAC notifies you when changes will be made to your computer that require administrator-level permissions. These types of changes can affect the security of your computer or can affect settings for other people who use the computer. We recommend that you leave UAC to help your computer course.

    Method 3:

    Temporarily disable all security software and try to install.
     
    http://Windows.Microsoft.com/en-us/Windows7/turn-Windows-Firewall-on-or-off
     
    http://Windows.Microsoft.com/en-us/Windows7/disable-antivirus-software
     
    Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you need to disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    If the problem persists, then I suggest that you post the question in the Microsoft Flight Simulator Games Forum for further assistance.

    http://www.fsinsider.com/

    FOR INFO:

    Flight Simulator 2004: Known video issues
    http://support.Microsoft.com/kb/823628

    Aziz Nadeem - Microsoft Support
    [If this post was helpful, please click the button "Vote as helpful" (green triangle). If it can help solve your problem, click on the button 'Propose as answer' or 'mark as answer '. [By proposing / marking a post as answer or useful you help others find the answer more quickly.]

  • Transfer of files from the old HARD DRIVE to new computer without an old computer. (He's dead - can not use) I have the hard drive, but need help to transfer my old files and settings.

    ·        My old Win XP computer died - it is completely unusable. I bought a new PC with Win 7 Pro and 1 TB. I still have the old HARD DRIVE (250 GB) which I have attached on the new computer using an external enclosure supports SATA drives. The external hard drive is connected to the computer in USB 3.0. I checked that the new computer can see the external hard drive. (I also used for backups by changing the hard drive with a 2 TB drive 'mass storage' - that works.)

    I searched the internet for possible solutions and found no help. If the transfer of files from Microsoft would change the disc to analyze, it would be simple. But if I select the OLD computer it scans the disk I'm on (new) - automatically.

    Is there anyone who has had the same problem? He must be because computers die all the time and people buy new computers - who then, somehow, they get the former transferred files. I could do it manually, but that wouldn't change the settings. Last resort would be to buy an old computer XP (SATA), replace the drive. Transfer the files, and then sell this computer.

    You may be able to recover your data files, but I hope that you will set up your new system to automatically backup a second internal hard drive or an external USB hard drive.

    This suggestion may not work, but it's worth a try. Buy an external USB drive enclosure. They come in two sizes 2.5 "for the portable computer drives and 3.5" for desktop disks. You can purchase adapters for 3.5 "envelopes so that they can also be used with a portable player. Place the hard drive in the enclosure and connect to a USB port of another computer. Several hard disks are more able to start, but the contents of the disc can still be accessed, read and copied from the disk because you do not use the operating system on a failed disk.

    Here is an example of the type of device, I suggest:
    http://www.amazon.co.uk/s/?ie=UTF8&keywords=external+hardrive+enclosure&tag=googhydr-21&index=aps&hvadid=14388537836&hvpos=1t1&hvexid=&hvnetw=g&hvrand=556960941559985931&hvpone=&hvptwo=&hvqmt=b&ref=pd_sl_32uorbwbuk_b

    You need only to the speaker, that you see are not necessarily more expensive. Thereafter, you can put an old hard drive usable, an abandoned because you need a larger drive internal, in the enclosure and use it as additional external storage.

  • FlashDrive work just need help? can not open files

    I need help read the files.

    Hello

    1 did you change on your computer before this problem?

    2. this issue occurs when opening a particular file in a flash drive?

    3. what happens when you try to open the files?

    4 What is the flash player recognize in disk management and Device Manager?

    5. which version of the operating system is installed on your computer?

    6. what version of the operating system Windows am I running?

    http://Windows.Microsoft.com/en-us/Windows7/help/which-version-of-the-Windows-operating-system-am-i-running

    Post back with more information for you help in this matter.

    Reference:

    Open the Device Manager

    http://Windows.Microsoft.com/en-us/Windows7/open-Device-Manager

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

  • want that computer back when I bought it, but need help on Toshiba satellite Home Premium runnin vista

    I covered by default sotware (Toshiba Recovery Wizard) on my computer I wanted to get back to when I bought my computer, but under this option, it is also recover without changing the hard drive partitions and then also recover from a patition custom size what we I do I have nothing really important on my computer that I need so I don't know that one can someone please help me make this recovery I do not pick up the wrong one please help? I need help because I can not use my pointer also and do not know how to get back to this page of recovery if my computer is to go off, so if someone is here now and can help me I would greatly appreciate your help thank you!

    Hi Dad428

    I would choose retrieve it without changing the partitions, which seems to be the safest way. You have backed up your data because you do not have the option of backup during the recovery process.

  • Flash player is not required to use a 32-bit work but any help is for vista, I need help windows 7 as vista doesn't work__

    Please help I need to downgrade to a 32-bit so I can down the daod flash player I followed using vista it says installed but does not work

    For any question on Windows 7:

    http://social.answers.Microsoft.com/forums/en-us/category/Windows7

    Link above is Windows 7 Forum for questions on Windows 7.

    Windows 7 questions should be directed to the it.

    You are in the Vista Forums.

    See you soon.

    Mick Murphy - Microsoft partner

  • My quicktime player says he needs codecs to continue, but download a virus. Windows Media player does not work. Need help for media players to work for movies. __

    It seems that two media players are missing essential files to run the program.

    <"My quicktime="" player="" says="" it="" needs="" codecs="" to="" continue,="" but="" download="" has="" viruses..."="">

    If the contents of download have virus scan your system with the last definitioned app antivirus in safe mode.

    S.Sengupta Media Center MVP

  • V5 - 573G - Windows 7 - bluetooth is not working, really need help!

    Hello

    I bought V5 - 573G in Germany, they like linux installed on it, weird, I know

    But anyway, I installed windows 7 on it because I prefer that the OS and all worked well. The only thing that didn't work was bluetooth.

    I installed all the drivers from the CD that I had and here is the printscreen after I installed all the drivers, everything seems to be 'OK' according to this list:

    So, how to manage start this bluetooth? I already tried with system32 files, the fsquirt.exe and everything, nothing works.

    On your acer.com website, you have only drivers for windows 8... I think it's a little unfair. There are still many users who prefer win 7 and there should be drivers for win 7 also as well. Could you please give me the download link for the windows 7 drivers bluetooth version?

    It is said that, by not giving the drivers for win 7, you're basically forcing people to run win8 so that this laptop works 100%.

    Anyway, if there is anything I can do for this laptop run on win 7 and still get the bluetooth works, then Im happy. At least my old acer (4810 t timelinex) had activation bluetooth on Fn + F3 key (same location where you can turn on wifi). The new V5 he had done the same thing... There should be some sort of grahpical UI (GUI)

    with buttons toggle just like that.

    IM grateful for any help, thanks in advance!

    Edit: I accidentally clicked on "accept as solution", my bad, it is not yet resolved, so I would be very happy for more advice about this problem. If a moderator could see this message, I want to ask permission to "unsolve" this cause of thread, it seems that I have no access to do so. Thank you!

    It is a BT Atheros module, try to install this:

    http://global-download.Acer.com/GDFiles/driver/Bluetooth/Bluetooth_Atheros_7.4.0.122_W7x64_A.zip?ACE...

    Maybe you need the Acer launch also, Manager to allow BT with the key combination:

    http://global-download.Acer.com/GDFiles/application/LaunchManager/LaunchManager_Acer_8.00.8105_W81x6...

  • No administrator accounts work! Need help urgent

    Well, it's my fault some how... Someone I was showing how to use command prompt to disable an account (net user active: No.). After doing this to one of the accounts, passwords or same user represents for all users, except the comments which I currently use, have stopped working.

    I tried to use a reset disk (created on another Vista computer because of the absence of law on this one [damm UAC]), but which returns an error when I try to use to change the password. User accounts are still there, though Vista says they are anyway. When, in the guest account, I went in CMD and typed "Internet users" and it returned:

    C:\Users\Guest>net users

    User accounts for \\LAPTOP
    -----------------------------------------------------------------------------------
    Comments Aaron administrator
    Jeeessicaaah Michael
    The command completed successfully.

    So, I think that user accounts are there, but the passwords are just play up.

    I tried to go into safe mode and enter the 'Administrator' user, but does not appear in either safe mode. Guest is the only accessible account on this computer and I need to desperately to fix this as its actually my fathers laptop. This is a pre-loaded Windows Vista Home Premium Acer laptop with no disc supplied. I even tried to go to the option "Repair my computer" after hitting F8, but no, it requires one of three Admin accounts that passwords do not work. and re - install is not an option that I am able to do.

    I really really need to solve this problem, so if anyone anyone with a halo over their heads can help me I would very much appreciate it.

    I tried everything before everything requires an administrator password, because UAC is on and in safe mode is not the Admin account... BUT!

    I corrected this by enducing a repair to start after system boot failure 2 - 3 times and he did a system restore, luckly it was before I stuffed around with the account, so now the passwords work again, in any case thank you all :D

  • Aero does not work! Need help!

    I recently installed windows 7 on my Sony Vaio Model # SVE14112FXW who had 7 Windows installed Home Basic Edition!
    I downloaded and installed all the drivers need for this! Its a graphics card Intel HD based computer laptop, it allows to view the properties of HD graphics on the home base, but does not appear on the ultimate edition. Is it because I installed the 32-bit version of ultimate? and the driver is 64-bit? ??

    Please help me!

    I think that the Home Basic doesn't have Aero work.  It seems that Aero start in Windows 7 Home Premium.

  • 1st time scripter... needs help with conditional step 2

    Never write the script in any form. JavaScript can be Cuniform as far as I know.

    Really want to understand such things.

    Download all guides... they make my head ache. Would like any suggestions on a good starting book. entry level stuff.

    Should I go to learn Javascript, then it'll all be easier?

    This is the purpose of the script that I want to write.

    I have a folder folders containing main/artist name/backup / retouched / * this is the lie of the images *.

    also / intact / * this is the lie of the images *.

    I would like to write a script that sends Photoshop thanks to all subfolders looking for files.

    Open the file.

    Determine if the file is grayscale.

    If this isn't the case, close the file.

    If grayscale determine the longest side of the image and resize it to 300 DPI maintaining proportions making long side 10 inches.

    Save the file in the folder '_8x10' file name added

    Save the file in "' C: / getty /" add "_8x10" file name "

    Close the file without saving changes

    OTHER IMPORTANT FACTS

    Emphasizing the need that the originals should not be harmed in any way.

    99% of the files are .tiffs others would jpg - I can't ignore jpg files in order to remove a variable.

    I worked on it for 2 days, trying to teach me, and it is not just by clicking. I can't pick it up quickly.

    Here's what I wrote and tried to patch all of the other scripts on the web in the hope that I understood why I was picking up this code.

    I'm short on time and would like advice on this.

    Here is my code:

    GrayscaleThenLandOrPortTo10Inches300dpi.jsx

    Copyright 2012

    Written by Brian Shupe steal shamelessly on the net

    /*

    Description:

    This script finds the folder and all subfolders for images.

    Check to see if they are grayscale

    If so, he trims the long side at 10 inches at 300 dpi

    */

    turn on double click of the

    Macintosh Finder or Windows Explorer

    #target photoshop

    Make Photoshop the frontmost application

    where we double clicked on the file

    app.bringToFront ();

    ///////////////////////////

    //       SET-UP          //

    ///////////////////////////

    Close all open documents

    so that {(app.documents.length)

    app.activeDocument.close)

    }

    Create the dialog select parent folder

    var imageFolder is Folder.selectDialog ("select a folder with images to treat");.

    Set variables naming for easier coding

    var doc = app.activeDocument;

    set the units to inches

    Save current preferences

    var strtRulerUnits = app.preferences.rulerUnits;

    var strtTypeUnits = app.preferences.typeUnits;

    Adobe Photoshop CS4 use pixels and display without the value dialog boxes

    app.preferences.rulerUnits = Units.INCHES

    app.preferences.typeUnits = TypeUnits.INCHES

    app.displayDialogs = DialogModes.NO

    Recursively process all subfolders

    If (image! = null) processFolder (imageFolder);

    function processFolder (folder) {}

    List of files of the var = folder.getFiles)

    for (var i = 0; i < fileList.length; i ++) {}

    var file = list of files [i];

    }}

    Check if the active document isn't in grayscale. If this is true do nothing

    If (doc.mode! = DocumentMode.GRAYSCALE) {}

    } else

    Check if the document is higher than it is wide

    If (doc.height > doc.width)

    {

    Perform this action if the IF statement is true. Action of sizes both height to 10 inches and 300 DPI

    doAction ("Port", "Getty");

    }

    on the other

    {

    Perform this action if the IF statement is false. Action sizes two length of 10 inches and DPI to 300

    doAction ("Land", "Getty");

    }

    Create a folder to contain a file duplicate

    myFolder var = new Folder("c:/Getty/");

    myFolder. Create();

    saveFile = new file ("C: / Getty /' + imgName +"_"+"8 x 10")

    var CurrentFolder = activeDocument.path;

    var ParentFolder = decodeURI (activeDocument.path.parent);

    saveFile = new file (parentFolder + ' /' + 'CONTAINER BACKUP' + ' /' + imgName + "_" + "8 x 10")

    app.activeDocument.close (SaveOptions.DONOTSAVECHANGES)

    I think that, right now, the problem is when it gets to the point where he seeks an image open... There are jumps to zero and it.

    Anyone can see that for my clumsy attempt and course correct me?

    would be happy to discuss tutoring services.

    This is a full version that could help with all of the necessary steps...

    #target photoshop
    app.bringToFront();
    main(); //call the main function
    function main(){
    var folders =[];
    var topLevel = Folder.selectDialog("Please select top level folder");
    if(topLevel == null) return; //if cancelled quit
    folders = FindAllFolders(topLevel, folders);
    folders.unshift(topLevel);
    var outputFolder = Folder("/c/Getty/");
    //create output folder if it does not exist
    if(!outputFolder.exists) outputFolder.create();
    for(var z in folders){// loop through all subfolders
    var fileList = folders[z].getFiles("*.tif"); //get a list of all tifs in this folder
    for(var a in fileList){//loop through all files in folder
        app.open(fileList[a]);//open file
        var doc = activeDocument;
        if(doc.mode != DocumentMode.GRAYSCALE){//if not greyscale close and get next doc.
            doc.close(SaveOptions.DONOTSAVECHANGES);
            continue;
            }
        if(doc.width > doc.height){//landscape
            //resize document, only one value is required otherwise it might distort the document.
            doc.resizeImage(new UnitValue(10,'in'), undefined, 300, ResampleMethod.BICUBIC);
            }else{//portrait
                doc.resizeImage(undefined, new UnitValue(10,'in'), 300, ResampleMethod.BICUBIC);
                }//end resize
            //get the name without the .tif extension
            var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
            //create the output file path and name
            var saveFile = File(outputFolder + "/" + Name + "_8x10.tif");
            //save and close
            SaveTIFF(saveFile);
            doc.close(SaveOptions.DONOTSAVECHANGES);
        }//end filelist
    }//end folders
    }//end main function
    function FindAllFolders( srcFolderStr, destArray) {
     var fileFolderArray = Folder( srcFolderStr ).getFiles();
     for ( var i = 0; i < fileFolderArray.length; i++ ) {
      var fileFoldObj = fileFolderArray[i];
      if ( fileFoldObj instanceof File ) {
      } else {
             destArray.push( Folder(fileFoldObj) );
      FindAllFolders( fileFoldObj.toString(), destArray );
      }
     }
     return destArray;
    }
    function SaveTIFF(saveFile){
    tiffSaveOptions = new TiffSaveOptions();
    tiffSaveOptions.embedColorProfile = true;
    tiffSaveOptions.alphaChannels = true;
    tiffSaveOptions.layers = true;
    tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
    activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
    }
    
  • Liquefy tool stopped working properly need help ASAP!

    OK, so last night, I used the Liquify tool on a selected area of the image and it worked fine. Well, now when I select my domain and try to use it, it just distorts the space and does nothing else. The options and display of fluidity never developed. I think it's just repeating what I did to liquefy the last time that I used it instead of giving me the opportunity to do what I have to do. It just won't let me do SOMETHING with the tool other than warping (what I think is the "repetition" of the previous use effects) everything else in photoshop works very well for me, that's the only problem I have. Prior to this, it would break just when I tried to open to liquefy, but I fixed that by changing the video codecs/plugins to those who work with him so that he is no longer a problem, it doesn't freeze or anything like that. So why is he just repeat what I did last time? Why can I not USE the effect? Help! Laughing out loud

    Are you clicking on the fluidity of everything at the top of the menu filter where the last used filter has a Cmd / Ctrl + F shortcut, or in its usual position below the menu? If the former then hold down the Opt/Alt key when you click the top element (or pressing Cmd / Ctrl + F) to open the dialog filter instead of just re - apply the last used filter.

Maybe you are looking for