Such a powershell script exist?

Windows Server Standard 2012R2. I know not enough about powershell scripts to be dangerous. So I guess that its better to ask for help on this one. As you know, in the Windows backup program, the e-mail feature is depreciated on server 2012. However, I had no problem of customization of a powershell script that I found so that it sends an email when the nightly backup is completed successfully. Te was easy to do. In Manager tasks I just put the firing an event, with the event being backup Windows and a number of event 4 - which means backup completed successfully. In fact, it works very well for my clients.  But it is not the fault of my client. (of course!)

Customers only the desire to receive an email if the backup is not successful. But the reasons for a backup failed are many which can generate any number of errors in the event log. Since I'm just not knowledgeable of powershell scripts, I hope someone can help me here, or at least direct me to where I can get help. Basically, I need a script powershell like this:

Trigger is "the eventID 14 (completed backup operation).

If eventID in the Microsoft-Windows-backup/OPerational log prior to the triggering event is not 4, while sendmail

This above would of course, include my work already sendmail script. Is this possible? Maybe someone has already done? Any help would be appreciated.

Hello

For technical support, repost the question in the Windows Server Forum.

https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home

Tags: Windows

Similar Questions

  • Get-QADComputer fails if run PowerShell script through Orchestrator workflow

    I use the "Get-QADComputer" cmdlet in my .ps1 script that is supposed to run via Orchestrator.  I have several PowerShell scripts started by Orchestrator and run on a host windows without any problem.  For this script, I have these 2 commands and still error.  The script does not error when run locally.

    Add-PSSnapin Quest.ActiveRoles.ADManagement - ErrorAction SilentlyContinue

    $Computer = get-QADComputer-identity "server01" | where {$_.name - eq "server01"}

    In troubleshooting, I ran Get-PSSnapin and can see that the snap for AD is loaded successfully.  I tried Connect-QADService and who also gives the same error, although it works very well on place.

    I use vCO 5.1.1. device.   On the hosts Windows where are the scripts PowerShell, the AD snap is version 1.6.0.2683.

    Here is the error in the logs Orchestrator...

    PowerShellInvocationError: Errors found during execution of script

    System.Runtime.InteropServices.COMException (0x8007054B): the specified domain does not exist or could not be contacted.

    at Interop.ActiveDs.IADsOpenDSObject.OpenDSObject (String lpszUserName, String lpszPassword, String lpszDNName, Int32 lnReserved)

    to Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.AdsiDirectory.NativeBind (adsPath String, AuthenticationTypes bindFlags)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.AdsiDirectory.BindToObject (String dn)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.DirectoryAccess.ConnectorFactory.Create (String serverName, user String, SecureString password, type of ConnectorType)

    to Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.ConnectionAwareCmdlet.EstablishConnection (ConnectionProperties connectionProperties)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.ConnectionAwareCmdlet.GetContainer)

    at Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet.BeginProcessing)

    at System.Management.Automation.Cmdlet.DoBeginProcessing)

    at System.Management.Automation.CommandProcessorBase.DoBegin)

    (Name of the dynamic Script Module: invokeScript #14)

    Thanks for the info.  I use the workflow "Invoke an external script" to run many of my host admin PowerShell scripts.  It is easier for me to keep all .ps1 files in one place and not import them into Orchestrator.  The article prompted me to switch my connection to host basic Powershell to Kerberos.  To do this, I had to update /etc/krb5.conf on the device of the vCO.  I've referenced VMware KB2036986 to work around the problem "unable to get kdc for the Kingdom.  This issue was mainly because we couldn't have krb5 configured previously.

    Now, I got a different error during execution of the workflow after bouncing vCO.

    System.NullReferenceException: Object Reference not set to an instance of an object.

    Has pointed out me the need to first make the connection AD.  He has not worked before without Kerberos authentication.  Once I added these lines of code, Get-QADComputer finally worked without error!   Thanks for the help.

    $pass = ConvertTo-SecureString - AsPlainText-Force - String "password".

    Connect-QADService - "example.com\serviceaccount" ConnectionAccount - ConnectionPassword $pass

    $Computer = get-QADComputer-identity "server01" | where {$_.name - eq "server01"}

    Disconnect-QADService

  • PowerShell Script - Annotations to CSV

    Hello everyone!

    I need a liitle powershell script that does the following.

    Get all the VM and when "CustomAttribute" is set to 1, write the values such as CPU, RAM,... in a csv file.

    I tried like this:

    $VMExport = get - VM | Get-Annotation CustomAttribute - Export | Where-Object {$_.} {Value - eq 1}

    But now, I have only the value 1 in the Variable '$VMExport' and can not use it for more things.

    Can someone help me with this?

    The CustomFields is a hash table, you can access the values by using the key as the index.

    You will need to use a property calculated for this

    $VMExport = Get-VM | where {Get-Annotation -Entity $_ -CustomAttribute Export | Where-Object {$_.Value -eq 1 }} |
    Select Name,ProvisionedSpaceGB,MemoryMB,NumCpu,Description,   @{N="Custom Field";E={$_.CustomFields["CustomFieldName"]}}
    

    It retrieves the value of the custom field called 'CustomFieldName' and it appears under the "Custom Field" property.

  • vCenter alarms and calling a powershell script

    OK, I'm missing something or I'm doing something incredibly stupid.

    I created a simple powershell script that starts a pre-defined VM. I tested it in PowerGUI, it works fine, no problems so far.

    Now all I want to do is set an alarm to ANOTHER VM of vCenter, such that if the virtual machine goes down (power of the off state), the script above is called and "failover" VM is started.

    I set up the alarm with a "run a script" action, the script is: "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe C:\SCRIPTS\FAILOVER.ps1" (including the quotes).

    And you guessed it: the script does not run. I'm sure that it doesn't, because the part of the script creates a log file, and this file is not creaed (it IS created when I run the PowerGUI script).

    What I am doing wrong? How can I get the alarm to hit my script?

    Thank you!

    I've never managed to run a PS script this way or the other.

    But I found a workaround.

    You can start your PS script indirectly via a BAT or CMD file.

    That's what I set in the value field

    c:\windows\system32\cmd.exe /c c:\Scripts\alarmscript.bat
    

    And the BAT file contained this

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsolefile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -Command C:\Scripts\Test-Alarm.ps1
    

    In the example script I used

    Get-VIToolkitVersion | Out-File "C:\Scripts\PSOut.log" -Append
    Get-PSSnapin | Out-File  "C:\Scripts\PSOut.log" -Append
    
  • Publishes a PowerShell Script

    I have a system which gives some issues where I have to restart some services from time to time.

    The problem is that these are problems on the server for a period of work of China - so I'm Home sleep away.

    I can easily restart services using PowerShell, so I thought I have publish a PowerShell script that one guys can run from AppPortal.

    Thought it would be easy (probably is and my brain doesn't work)...  Publish path to powershell (C:\windows\...) and use the file "path\to\script.ps1" as an argument - however, I can't seem to make it work.

    So, how in the heck would I do this?

    Hey Mike,

    Is this a problem of execution policy? You can try adding '-ExecutionPolicy Unrestricted ' at the command line?

    Adam

  • PowerShell script

    Hello

    Say I want to install the Microsoft Patches each month on a field with 50 + servers. I need a script that could give me the following,

    (i.) the availability of each server present in the field, while running the script.

    II.) he should list on the fixes that have been set up so far and this should be exported to excel.

    Servers are 2003 & 2008. Also, I'm not particularly on Powershell scripts. So anything that meets the objective would be really useful.

    Please help me with this.

    Thank you much in advance.

    René-coral. (* E-mail address is removed from the privacy *)

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • Newbie question - tide may run a remote PowerShell script or BAT file?

    My first post.  I am new to raz, but I've had experience with other planners.

    I have a PowerShell script that must be run on a remote computer.  All the script needs software is installed on this computer.

    In addition, I need the script runs under a service account.  Is it possible and if yes, how can I go about it?

    This work will be be launched manually whenever this is necessary.

    Sure. There are some screenshots. A variable one, I used for the location of the folder on the server of tide (not required but I use a lot of scripts). One for the command of tide itself. The last one is the script runs remotely on windows work. Let me know if they don't make sense.

  • How to change power mode using powershell script?

    In Windows 7, there are 2 available for selection (balance or eco) power switch mode.

    I would like to know if it is possible to script powershell code to pass these 2 modes of window 7 or not.

    Does anyone have any suggestions?

    Thanks in advance for your suggestions

    Hello

    You want to know about the encoding of a PowerShell script, I recommend that you post the question on the Forum on TechNet script where you will have the best support for any problem related to scripts.

    http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home?Forum=iTCG

    Thank you.

  • The Scripts PowerShell Script to remove AD Logon

    I'm trying to create a PowerShell script to remove the scripts of connection for all users in the AD.

    I'm trying to create a PowerShell script to remove the scripts of connection for all users in the AD.

    Hello

    Your question is addressed in these forums of consumers.

    Please use the following to ask this question.

    Windows 8 IT Pro category:

    http://social.technet.Microsoft.com/forums/en-us/category/w8itpro

    Concerning

  • ORDER FORM FRM-47023 No. such named SESSIONID parameter exists in OEXOEORD

    Dear Experts,

    I upgraded my instance of 12.1.1 to 12.1.3, but when I try to open the command I get the following message:

    ORDER FORM FRM-47023 No. such named SESSIONID parameter exists in OEXOEORD


    I get this message several times before opening the form.


    I searched through the metalink, but I have not found what I'm looking for.



    Any help.


    Ahmad,




    Dear Sir.

    I checked my R12.1.1 to ensure that I'll have this problem or not, but I don't have this problem and it works correctly.

    Maybe this error makes reference to errors during the upgrade process, but I don't know I just finished all the steps provided by Oracle support.

    Thanks for help.

  • Run the powershell script in Workflow VCO

    Hi guys,.

    I'm pretty new to VCO and I am facing difficulties to get what I want. For you, this will be a Basic... but here's my question:

    I have a WF that I use in the WFStubmachineprovisionning that can generate me a name of virtual machine based on the selection of the user while he asked for a virtual computer in the VRA.

    The VM provisionned name looks like this: W203PKLXXX and I need to replace the XXX with a number that is available on the network.

    To do this, I need to query the DNS to see if there is, if not, 002 001... And so on... until an available and I send the full name of the virtual machine to the WF Stubprovisionning.

    This my first try to interact between VCO and a Powershell script. I can run script PS on my host configured, but do not know how to send variables to the custom WF that generates the name of the script of PS and send the name of VM from the script of the PS to the next step.

    Can someone give me a sample of variable to manage? I can't find anything on the net

    Just to tell you that I managed.

    the PS has returned an XML object, not a string. I had to use the method getxml() javascript property, and parse the string to get the value I need

    I also had to blind correctly (getxml) entry and exit (PS)

    If needed I can send you a few screenshoot

  • How to change a script existing (ImageCatalog.jsx)

    Hello

    I use ImageCatalog.jsx to create pages in bulk with pictures on them, but they don't come out in the order of name.

    I found this existing forum that addresses how to do, but I don't know how to work with scripts - create a new document with the script text or replace text in the script exist (that I tried to do, but it did not work).

    Either way, I use Windows, not Mac.

    The current forum is here:Re: image sorting before import imageCatalog

    Any help would be appreciated.

    Thank you

    Amanda

    Hello

    Do not replace the line no 52 (inside a function myWinOSFileFilter (myFolder)):

    return myFilteredFiles;
    

    with this part of the code;

    return myFilteredFiles.sort(Names);
         function Names(a,b) {
              if (a.name.match(/^\d/) && b.name.match(/^\d/))
                   return parseInt(a.name) - parseInt (b.name);
              if (a.name > b.name) return 1;
              if (b.name > a.name) return -1;
              return 0;
              }
    

    Save (perhaps a copy...?) and run

    Jarek

  • Orchestrator + powershell script: variable

    Hello

    I want to create a workflow with an external script powershell and "scriptable task."

    First step:

    1. I set my input parameters in the "Task Scriptable" and "script" my variable entry for the external script powershell tab: scriptArgs = Variable1 + "" + Variable2;

    2. I get my variable in my outside first PowerShell script-> at this point it's OK

    3. in my outside first powershell script, I create variables $var1 and $var2

    Second step:

    1. I created a 'Scriptable task' and I want to get an exit powershell ($var1 and $var2) as a starter for my 'scriptable task. "

    I don't know how passing a powershell variable to any other 'workflow element' or 'scriptable task. "

    Invoke an external PS workflow script returns as objects of the output of type PowerShell:PowerShellRemotePSObject.

    You can use it to extract data from the output of the powershell script. Example is provided with the plugin inside the folder library/PowerShell/samples/list directory content workflow

    You can use PowerShell:PowerShellRemotePSObject to receive the output as raw xml, PowerShell:PowerShellRemotePSObject.getXml() data or using getRootObject() directlyas objects of type PowerShellPSObject, and then use getProperty (xxx)...

    Here is an excerpt of the example workflow to browse the list of files returned as a result of the invocation of the ps script.

      // Get PowerShellRemotePSObject
      var psObject = invResult.getResults();
      var directories = psObject.getRootObject();
    
      var isList =  directories instanceof Array
      if ( isList ){
      for (idx in directories){
      var item = directories[idx];
      if ( item.instanceOf('System.IO.FileInfo') ){//check type of object
      System.log( item.getProperty('FullName') );//extract value from result
      }
      }
      } else {
      System.log( directories.getProperty('FullName') );//extract value from result
      }
      }
    ...
    
  • In the Powershell script execution error: could not find the type [ordered]: make sure that the assembly containing this type is loaded.

    People,

    I am trying to load and run the PowerShell script of PowerCLI Module to check the CPU, memory and storage overcommitment. VMware PowerCLI Blog - VMware Blogs but somehow it is always stopped with the error: cannot find the [ordered] type: make sure that the assembly containing this type is loaded.

    Here are some of the diagnostic result:

    $PSVersionTable

    Value name

    ----                           -----

    PSVersion 2.0

    PSCompatibleVersions {1.0, 2.0}

    BuildVersion 6.1.7601.17514

    PSRemotingProtocolVersion 2.1

    WSManStackVersion 2.0

    CLRVersion 4.0.30319.1026

    SerializationVersion 1.1.0.1

    Get-ChildItem ' HKLM:\SOFTWARE\Microsoft\NET frame Setup\NDP'-recurse |

    Get-ItemProperty-name of the EA - 0 Version |

    Where {$_.} PSChildName-match ' ^ (?) (S) \p {L} "} |"

    Select PSChildName, Version

    PSChildName Version

    -----------                       -------

    v2.0.50727 2.0.50727.5420

    3.0.30729.5420 v3.0

    Windows Communication Foundation 3.0.4506.5420

    Windows Presentation Foundation 3.0.6920.5011

    3.5.30729.5420 v3.5

    Customer 4.0.30319

    4.0.30319 full

    Get-PowerCLIVersion

    PowerCLI Version

    ----------------

    VMware vSphere PowerCLI 5.8 Release 1 build 2057893

    ---------------

    Versions of the snap

    ---------------

    Build VMWare AutoDeploy PowerCLI component 5.5 1983942

    Build VMWare ImageBuilder PowerCLI component 5.5 1983942

    Build license of VMware PowerCLI component 5.5 1265954

    Build VMware Storage PowerCLI component 5.8 2057894

    Build VDS's VMware PowerCLI component 5.8 2031581

    Build VMware vSphere PowerCLI component 5.8 2031581

    I installed Windows6. 1 -KB2819745- x 64 - MultiPkg.msu to enable Powershell v4.0 on my Windows 7 laptop, but still the script cannot be executed with the above error message.

    Any kind of aid and assistance would be greatly appreciated.

    Thank you

    Hello-

    Ah, yes--it is that review.

    Another option, because you are not able to go to .NET FX 4.5, is to remove the parts "[ordered]' of the code that you use.  This type Accelerator makes the hash table a dictionary sorted.  The effect to remove that from the code will be that the properties of the object that results will not be in the order in which they appear in the code.

    And, another option would be to install PowerShell v3 (the version in which the '[ordered]' feature has been added').  That shouldn't require a FX .NET newer than what you showed as having already installed on this computer.  However, as we have seen with the PSSnapin and PSv4 Exchange, you want to make sure that the PSSnapins / Modules you want to use are compatible with PowerShell v3.

  • Struggling to run Powershell scripts / commands

    Hi all!

    I'm fighting to get the Powershell vCO workflow.  I think I missed something really obvious, but I can't see it...

    I did the set Kerberos in place on the line of my vCO 5.5.2 machine.  I added a Powershell v2 host using VMWare provided Powershell 1.0.4 workflows plugin install, Kerberos authentication and using a shared account (mine, I know that I am an admin on Windows Server).  I assured the Kerberos authentication and unencrypted traffic is accepted on the Powershell host.  If I validate the object created at the CVO, he says it's fine.

    When I come to run another VMware provided workflow, I get responses to error because the workflow doesn't seem to be properly trained, or I get a null response.  When I run a workflow, I can see my account by logging in the Windows Server 2008 security log, so I'm pretty confident that the basic connection and portions of Kerberos are all ok.

    I just tried to simplify a VMware provided workflow, to make it as a possible base (code below).  I always get a Null response.  Anyone have any ideas why?  Or did someone is able to provide the code for a very simple Powershell-based workflow that they know works so I can test it on my set up?

    The VMWare-based simple powershell script provided one to get the contents of some directories and the values that I use - it returns null:

    the hostentry, type: PowerShell:PowerShellHost, value: < myPowershellHostSelectedFromPluginManually >

    Directoryentry, type: String, value: I manually enter $home.  Or C:.  Or C:\Windows.  Or any other directory I know there is that my user account has no light problem.

    output of the result, type: string, value: regardless of the ("DIR" + directory) output >

    var Sess;

    connect to the host

    Sess = host.openSession)

    Send the command in powershell

    sess.addCommandFromString ("dir" + directory)

    invoke the command

    invResult = sess.invokePipeline ();

    get the result

    Result = invResult.getResults)

    Send to open a session

    System.log ("Result is" + result)

    Thank you very much in advance!

    And there we go...  Who sets: powershell.exe wasn't in the path of the Windows host!

    Thanks for the help everyone, especially igaydajiev for giving me the pointer of the final to my answer!

Maybe you are looking for

  • can't get my swagbucks toolbar, it is installed, but will not be displayed

    I updated Firefox, and now my Swagbucks toolbar disappeared. I have the latest version of the installed swagbucks and the "search with hinder" we're still working, but my normal Swagbucks isn't the case to find. I used to be able to see a list of too

  • Debit card not accepted - why?

    It is a valid card from my Bank, not a prepaid card, but he always tells me the card is declined.  There is a lot of money in the account to cover a purchase of the movie, then why does he not accept my card?  I keep seeing posts on this problem and

  • How long are icloud videos stored on the iphone?

    I have photo library enabled on my iPhone6 iCloud.  More photos and videos are removed from the device, but more recent photos and videos of sticking around for a while.  I wonder what is the retention time window.  I have a bunch of videos of the ph

  • problems with table formatting

    Hi all I currently have problems with formatting or to use a table to record the data (well it will be saved in a .csv file, but I'm trying to use the table to get it all properly formatted to the .csv file for ease of reading). It is probably someth

  • 3054 HP doesn't scan wireless

    Hello world! I have a HP 3054 which has always worked fine without thread before today... Currently, it allows to print wireless from my macbook pro very well without any problems, but it will not scan! To scan, I need to connect the USB to the compu