Remote Diskpart using Powershell

I am trying to issue the following command (which works fine locally) remotely without the help of WinRM:
$Commands = @"
rescan
exit
$Commands | diskpart.exe
This is what I currently have:
$Computer = "myserver"
$Credential = Get-Credential
$Commands=@"
rescan
exit
iwmi -Path win32_process -Name Create -ComputerName $Computer -Credential $Credential -ArgumentList ($Commands | diskpart.exe) | Out-Null
But it fails with:
Invoke-WmiMethod : Invalid operation
At line:8 char:5
+ iwmi <<<< -Path win32_process -Name Create -ComputerName $Computer -Credential $Credential -ArgumentList ($Commands | diskpart.exe) | Out-Null
+ CategoryInfo : InvalidOperation: (:) [Invoke-WmiMethod], ManagementException
+ FullyQualifiedErrorId : InvokeWMIManagementException,Microsoft.PowerShell.Commands.InvokeWmiMethod
Does anyone know what is happening or have a better method for accomplishing this task?

Hi!
I had a similar need today.  Just published
PSDiskPart.  Long story short, it dumps a diskpart script on the remote system, uses WMI under the covers to launch diskpart, redirects output and errors to independent files on that system, pulls these files in from the remote system.
A quick example, bringing disk 2 online:
On a side note, thanks for the diskpart parsing details Adam, very helpful!
Cheers!

Similar Messages

  • Is it possible to add a PC to a domain via a remote CLI using Powershell?

    If this is going into a domain, which it sounds to be the case, you'll be using a specified base image as per your company policy (image A goes to computer build A group). If you are using SCCM, FOG, etc... A better method would be to put in a task sequence to integrate the machine, at the end of the sequence of course. Don't want GPOs and firewall settings coming up before everything is complete. This would also allow you to automate the process, rather than push it manually.

    I saw an instructional video from "Eli the Computer Guy" about adding Windows 8.1 PC's to a Server 2012 Domain. He did it via the GUI which is what I am very comfortable with, but I would love to be able to do this via a remote command line using Powershell, is this possible? Let's say my Workgroup is ABC and the Domain I'd like to join the PC to is BCORPINC
    Thank you
    This topic first appeared in the Spiceworks Community

  • Running executable installer on remote PCs using powershell

    I have a script to remotely install msi, it is working fine but I have one piece of software cannot be converted msi , only comes with .exe
    I am not sure how to chekc the current script to run as executable not msi npackage: anyonme can help???
    $CurrentLocation = 'c:\test'
    $msi = @('Teedriver.msi')
    foreach ($msifile in $msi) 
    Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList "/i `"$msifile`" /qn /passive" -Wait -WorkingDirectory $CurrentLocation
    When I change to
    $CurrentLocation = 'c:\test'
    $setup = @('Teedriver.exe')
    foreach ($_. in $setup)
    Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList "/i `"$setup`" /qn /passive" -Wait -WorkingDirectory $CurrentLocation
    It didn't work.

    Hi Tim,
    You have to use the $exefile variable inside the foreach loop tp make it work if there are more than one exe:
    $CurrentLocation = 'c:\test'
    $exe = @('Driver_v102_Win7_64Bit','Another_executable_file')
    foreach ($exefile in $exe)
    Start-Process -FilePath "c:\test\$($exefile).exe" -ArgumentList "/qn" -Wait
    In above example we define an array with the exe names which are 2 in number.
    So when we iterate over using foreach we reuse the variable $exefile.
    hope this helps
    Knowledge is Power{Shell}
    DexterPOSH
    My Blog

  • Trying to add a role on a remote server using windows powershell.

    Im reading a book that wants us to install a role on a remote computer using powershell.  The comands below is what we are sopuse to use and nothing happens.  Does anyone know why?
    function Invoke-WindowsFeatureBatchDeployment {
    param (
    [parameter( mandatory)]
    [string[]] $ ComputerNames,
    [parameter( mandatory)]
    [string]
    $ ConfigurationFilePath )
    # Deploy the features on multiple computers simultaneously.
    $ jobs = @()
    foreach( $ ComputerName in $ ComputerNames) {
    $ jobs + = Start-Job -Command { Install-WindowsFeature -ConfigurationFilePath
    $ using:ConfigurationFilePath -ComputerName $ using:ComputerName -Restart } } Receive-Job -Job $ jobs -Wait | Select-Object Success, RestartNeeded, ExitCode, FeatureResult }
    Then after this he states it is going to want a few parameters, for example.
    # Sample Invocation $ ServerNames = 'TestServer_01', 'LabServer_02' Invoke-WindowsFeatureBatchDeployment -ComputerNames $ ServerNames -ConfigurationFilePath C:\ RemoteDesktopConfig.xml

    I've been working on this for the last hour or so and here is what I got. Any ideas?
    PS C:\Users\Administrator> foreach ($computerName in $ComputerNames) {
    >> param (
    >> [parameter (mandatory) ]
    >> [string[]] $ComputerNames,
    >> [parameter (mandatory)]
    >> [string] $ConfigurationFilePath
    >> )
    >> $jobs = @()
    >> foreach ($computerName in $ComputerNames) {
    >> $jobs += Start-Job -Command {
    >> Instal-WindowsFeature
    >> -ConfigurationFilePath
    >> $using:ConfigurationFilePath
    >> -ComputerName
    >> $using:ComputerName
    >> }
    >> }
    >> Receive-Job -Job $jobs -Wait | Select-Object
    >> }
    >> $ServerNames = 'WIN-AN69NIQ6ARI'
    >> Invoke-WindowsFeatureBatchDeployment
    >> -ComputerNames $ServerNames
    >> -ConfigurationFilePath C:\Users\Administrator\Desktop\DeploymentConfigTemplate.xml
    >>
    Invoke-WindowsFeatureBatchDeployment : The term 'Invoke-WindowsFeatureBatchDeployment' is not recognized as the name
    of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
    verify that the path is correct and try again.
    At line:21 char:1
    + Invoke-WindowsFeatureBatchDeployment
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Invoke-WindowsFeatureBatchDeployment:String) [], CommandNotFoundExcepti
       on
        + FullyQualifiedErrorId : CommandNotFoundException
    -ComputerNames : The term '-ComputerNames' is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:22 char:1
    + -ComputerNames $ServerNames
    + ~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (-ComputerNames:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    -ConfigurationFilePath : The term '-ConfigurationFilePath' is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At line:23 char:1
    + -ConfigurationFilePath C:\Users\Administrator\Desktop\DeploymentConfigTemplate.x ...
    + ~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (-ConfigurationFilePath:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

  • How to set IPaddress to a VM which has Linux OS using powershell remoting.

    I have downloaded the SetLinuxVM scripts for setting the ipaddress of virtual machine which has Linux as OS. I have 2 different Hyperv host machines for Eg: HostServer1 and HostServer2  and I have installed SetLinuxVM scripts on server HostServer1 but
    my LinuxVM is created in HostServer2 and is highly available.
    Now I have development server from where I connect to any of these HyperV servers remotely .
    I have created powershell remote session from my development server to HostServer1 where SetLinuxVM scripts are installed and excuting the script as given below.
    Set-LinuxVM -VMName "TestLinuxVM" -Manager "Hyper-V" -VMHost "HostServer2"
    -Username "root" -Password "Gen#123" -Hostname "TestLinuxSrv " -IPAddress "192.168.2.2" -SubnetMask "255.255.0.0" -GatewayAddress "192.168.2.1" -PrimaryDNSAddress "8.8.8.8" 
    Even though I am providing the -VMHost and even if the VM is in cluster its not executing the scripts and I am getting the error  WMI not available.
    Its working fine if the scripts are installed on HostServer2 where the LinuxVM is created but my question is that do we need to install the scripts on all HyperV hosts then whats the use of the above parameter -VMHost "HostServer2"  because if
    the hyperv host is remotely connected using powershell we need to provide the VMHost name in the above scripts.
    From the examples provided in the SetLinuxVM module my understanding is that if the SetLinuxVM module is installed in any of the Hyperv servers which  are in a cluster and even though the VM is created in any of the servers and is highly available by just
    providing the VMHost for that particular VM we can set the IPadress ,hostname etc by connecting remotely using powershell to the HostServer which has SetLinuxVM module by providing the VMHost name in the above script .
     Hoping that my problem will be resolved at your earliest convenience.
    Thanks in advance,
    Fayaz Syed.
    FayazSyed

    I am not familiar with these scripts, but in general any modules must exist on the target Hyper-V server.
    The commands do not appear to be suing SCVMM, in which case you would execute the PowerShell script at the VMM console machine.
    Brian Ehlert
    http://ITProctology.blogspot.com
    Learn. Apply. Repeat.

  • Get Remote Desktop access logs using PowerShell

    How to find all login/Logout/Reconnect and other log information from a remote computer using powershell
    This should also include from which client/machine (including which account) that connection has established.
    may be more in brief, like a RDP historical log, i.e., who all logged and performed what from startdate to enddate.
    Suresh Kumar Udatha.

    You would have to write a script to remotely query the Event log for all logon types required.  You would also need to write custom record data extractors for each log message type.
    I recommend starting in the Gallery and looking for scripts that query the windows event logs.  THis will show you the basics of event log reporting using PowerShell.
    What you are asking is a very large project.  The records you need are different fro different OSs.  Pre-Vista uses the old format and event IDs. Vista and later use a newer format.
    Security log performing is a specialized industry.  There are many companies that produce tools to do this.  I recommend looking into purchasing this tool.
    It can be written in PowerShell. I have written many event log extraction scripts.  It will take you quites some time to do as many record types as you aare asking for.
    ¯\_(ツ)_/¯

  • Similar to connecting to remote computer using WSManagement, how to do it through powershell terminal?

    I have the following code to connect to the remote powershell and execute script on remote machine :WSManConnectionInfo connectionInfo = new WSManConnectionInfo(false, "MachineName", 5985, "/wsman", shellUri, credential);
    using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo))
    runspace.Open();
    using (PowerShell powershell = PowerShell.Create())
    powershell.Runspace = runspace;
    String file = @"C:\scripts\createUser.ps1";
    powershell.Commands.AddScript(System.IO.File.ReadAllText(file));
    Collection<PSObject> results = powershell.Invoke();
    }How to execute the script in same way from powershell command prompt?

    Hi,
    The Invoke-Command cmdlet should to the trick for you using WinRM.
    Invoke-Command -ComputerName MachineName -Scriptblock {c:\scripts\createuser.ps1}
    The parameter -File could also be used for pointing to an UNC share or so.
    More information regarding the cmdlet is found below..
    http://technet.microsoft.com/en-us/library/hh849719.aspx
    Microsoft Certified Trainer
    MCSE: Desktop, Server, Private Cloud, Messaging
    Blog: http://365lab.net

  • Running a non mandatory program from remote using powershell without a logged in user

    Hi all,
    is there a way to execute a non mandatory program (a task sequence in my case) from remote using powershell
    without a logged in user on the target system?
    I have the following code: 
    $ProgramObject = Get-WmiObject -Class CCM_Program -Namespace "root\ccm\clientsdk" -ComputerName $ComputerItem | Where-Object { $_.Name -match "$ProgramName" }
    Invoke-WmiMethod -class CCM_ProgramsManager -Namespace "root\ccm\clientsdk" -Name ExecutePrograms -argumentlist $ProgramObject -ComputerName $ComputerItem | Out-Null
    Works like charm, but only with a user logged in on the target system what is not a good solution for me. 
    I saw some other ways on the internet but these only work when the program is mandatory.
    Is there a way to archive what I need ? 
    thanks 

    Hi,
    If you deploy the program as a available deployment, there need a user to run the program. Otherwise, the program will never run. This is contradicted with your requirement(run the program at log off).
    So I concur with Peter.
    Best Regards,
    Joyce
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Changing Computer Descriptions Remotely using Powershell

    Hello,
    I am the Network Admin for a small college that has a little over 300 computers. I want to be able to use PowerShell to change the computer descriptions on those machines from my desk. I have PowerShell 3.0 installed on my system. I am new to PowerShell
    so I could use some step by step instructions on what to do.
    For instance:
    I have a computer in my network that has a Computer Name of "19XP9175" and a description of "Optiplex 320 - Doreen Lane".
    I would like to change the description to read "O320-Doreen lane"  from my system using PowerShell 3.0.
    Can you give me some pointers on how to do this?
    Thanks
    Daryl

    This may not help with Powershell side of things, but we had a similar issue where we needed to change 100's of remote computer descriptions, so we created this tool:
    <snip>
    It allows you to local or remote connect to a computer on a network (run it with admin rights!) and gather and change the description immediately without requirement for reboot etc. 
    Hope it helps.
    <snip>
    So why are you bumping an old, answered thread in a PowerShell forum then? I get that you want to advertise your product, but at least keep on topic.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • Using powershell to deploy provider-hosted app and specify remote Url instead of using appinv.aspx page

    Hello all,
    Could you possibly help me with provider-hosted app development/deployment process.
    We developed SharePoint provider-hosted app that works just fine in development environment. Now we need to automate it's installation in test environment via powershell.
    In AppManifest.xml that we are deploying we have key instead of explicit URL:
    <App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest" Name="ShowAllRoomsApp" ProductID="{922a18aa-5592-b59a-4da9-4791baef02e7}" Version="1.0.0.0"
    SharePointMinVersion="15.0.0.0">
      <Properties>
        <Title>SomeTitle</Title>
        <StartPage>~remoteAppUrl/Pages/Default.aspx?{StandardTokens}</StartPage>
    If we use as
    https://technet.microsoft.com/en-us/library/jj655398.aspx recommends, we cannot specify Redirect Url as we can do this on
    /_layouts/appinv.aspx
    So now it seems like the only way to deploy this kind of solution is using appinv.aspx page.Or must we apply this URL in AppManifest on developing stage in Visual Studio?
    What did I miss?
    P. S. Even if I use /_layouts/appinv.aspx after powershell commandlets, I get error.

    hi,
    to deploy provider hosted app you need 2 things
    1. Client ID
    2. Redirect URL.
    What you can do you can generate app from visual studio using clientID and URL from developer enviornment.
    Now a app file is just a simple compressed zip file if you rename it as .zip and extract you will find AppManifest
    inside it. So to create an app for Testing enviornment what you have to to Get the CLient ID (from AppRegNew.aspx) in testing enviornment. Unzip .App file change the AppManifest with testing client ID and URL than again zip file and rename as .app.
    Now if you upload this file it will work.
    To automate this scenerio i have created a simple windows Application in which i Pass the Client ID and StartURl and an App File it unzips the app file make changes to app and again zip it.
    public static class AppPackageHelper
    public const string StartUrlExpression = "{0}?{1}";
    public const string StandardToken = "{StandardTokens}";
    public static string Publish(string appPath, string ClientId,string StartUrl)
    string tempDir = string.Empty;
    string outPutFile = string.Empty;
    try
    string parentDir = System.IO.Path.GetDirectoryName(appPath);
    outPutFile = System.IO.Path.Combine(parentDir, ClientId + "-Winshuttle.app");
    tempDir = System.IO.Path.Combine(parentDir, ClientId.ToString());
    Directory.CreateDirectory(tempDir);
    int lastInd = appPath.LastIndexOf('.');
    string tempPath = string.Empty;
    string targetFilePath = string.Empty;
    string cabPath = System.IO.Path.Combine(tempDir, System.IO.Path.GetFileNameWithoutExtension(appPath) + ".cab");
    FileInfo fInfo = new FileInfo(appPath) { IsReadOnly = false };
    File.Copy(appPath, cabPath);
    XDocument doc = null;
    string appManifest = string.Empty;
    using (ZipArchive zipArch = ZipFile.Open(cabPath, ZipArchiveMode.Update))
    appManifest = string.Format(@"{0}\AppManifest.xml", Directory.GetParent(cabPath).FullName);
    ZipArchiveEntry manifestEntry = zipArch.Entries.LastOrDefault(e => e.Name.ToLower() == "appmanifest.xml");
    manifestEntry.ExtractToFile(appManifest);
    doc = XDocument.Load(appManifest);
    XNamespace ns = doc.Root.GetDefaultNamespace();
    string defaultUrl = string.Format(StartUrlExpression, StartUrl.TrimEnd('/'), StandardToken);
    doc.Descendants(XName.Get("StartPage", ns.NamespaceName)).First().Value = defaultUrl;
    doc.Descendants(XName.Get("RemoteWebApplication", ns.NamespaceName)).First().Attribute(XName.Get("ClientId")).Value = setupInfo.ClientId.ToString();
    doc.Save(appManifest);
    if (manifestEntry != null)
    manifestEntry.Delete();
    zipArch.CreateEntryFromFile(appManifest, "AppManifest.xml");
    int totEnt = zipArch.Entries.Count;
    for (int e = 0; e < totEnt; e++)
    if (zipArch.Entries[e].Open().Length == 0)
    //if (zipArch.Entries.Count > totEnt && e >= totEnt) break;
    //zipArch.CreateEntry(zipArch.Entries[e].FullName);
    File.Delete(appManifest);
    if (File.Exists(outPutFile))
    File.Delete(outPutFile);
    File.Move(cabPath, outPutFile);
    return outPutFile;
    catch
    throw;
    finally
    if (System.IO.Directory.Exists(tempDir))
    System.IO.Directory.Delete(tempDir, true);
    return outPutFile;
    using System.IO.Compression.FileSystem.dll.
    Also if you want to do it using powershell You need to do the same thing unzip-> changes values-> zip
    So basic thing is You need to ahve only valid AppManifest file which contains 2 valid values Client Id and StartUrl
    if you changes it inside appmanifest manuall than it will also work. Using above code you can create a console Application to do it. You can use powershell it just that i dont know how to zip unzip in powershell but i am pretty sure you can easily find it
    on searching.
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Download RSS feed as xml file from Sharepoint Online using PowerShell

    Hello
    Our company sharepoint (Office 365) contains also several RSS feeds.
    How it is possible to download xml file out of this feed (website) using PowerShell?
    I can authenticate with sharepoint using CSOM but do not what to do next.
    As service user is not administrator I cannot use "SPOService".
    This script works OK for standard website, but not for Sharepoint.
    $doc = New-Object System.Xml.XmlDocument
    $doc.Load("http://www.{CompanySite}.com/feed/")
    $doc.save("C:\temp\feed.xml")
    I am getting this error when using for company Sharepoint:
    "The remote server returned an error: (403) Forbidden."
    Thanks for your time considering this question.
    Jozin

    Hi Scott,
    thanks for advice.
    Combination of WebClient and Sharepoint Credentials is working OK:
    $client = New-Object System.Net.WebClient 
    $client.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User, $SecurePassword)
    $client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $client.DownloadFile($SiteURL, $file)

  • How to add new group entry in Cisco Vpn using powershell

    I am working on a powershell script to connect cisco vpn using powershell, I am able to connect to vpn but not sure how to add new group to vpn. I am using the following script$vpn_profile = 'Test'
    $username = 'TestUser'
    $userPassword = ConvertTo-SecureString -String "Password" -AsPlainText -Force
    $credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist
    $username,$userPassword
    $password = $credentials.GetNetworkCredential().Password
    Set-Location 'c:\Program Files (x86)\Cisco Systems\VPN Client'
    .\vpnclient.exe connect $vpn_profile user $username pwd $password
    Write-Host "You Are Connected"
    cd "C:\"

    Have you entered .\vpnclient.exe /? to see if it will return information about other switches you can use with this executable? Other than connect, I was able to track down a few without actually having the executable (http://www.scribd.com/doc/40108893/Cisco-VPN-Client-Command-Line).
    That said, I do not believe that there is a switch that will help you create a connection. These are either done manually through the GUI, or can be likely be added by supplying a properly formatted file in the proper place.
    If you're using the version of the Cisco VPN client I think you are, then your connection settings, or profiles, are stored in individual .pcf files somewhere on your computer (likely in the Cisco directory). These are simple, text-based files. Find one
    on your computer, save it with another name, and then modify it manually. If you really want to use PowerShell, then use this opportunity to learn how to create and edit basic text files using PowerShell. If you have a standard connection file, then you can
    put that file onto remote computers any number of ways. If a .pcf file exists in the proper place when the VPN client is opened, then it likely will not prompt for a new connection.
    Update: Added more info; clarified

  • Second queston using powershell in SCOM as recovery

    Hi guys,
    In a previous question i needed some ideas about using powershell in a recovery.
    Now i've implemented this in the XML, but it gives me this error as i import my managementpack back in SCOM 2012 R2 UR 2
    Error, it gives the error on Microsoft.Windows.PowerShellWriteAction too:
    If any management packs in the Import list are dependent on this management pack, the installation of the dependent management packs will fail.
    Cannot resolve identifier Windows!Microsoft.Windows.PowerShellWriteAction in the context of management pack ANWB.Informatica.Powercenter0. Unknown alias: Windows.
    <Recovery ID="MomUIGenaratedRecovery7187d8e283b44c9c9a115f06af5d3dcc" Accessibility="Public" Enabled="true" Target="Type603f92b7b83945598af55495615db953" Monitor="UIGeneratedMonitor0cd347f57f3949deb958cebb02d25555" ResetMonitor="false" ExecuteOnState="Error" Remotable="true" Timeout="300">
    <Category>Custom</Category>
    <WriteAction ID="MomUIGenaratedModule8ea82cdaccd8404b810409334cc50e47" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
    <ScriptName>SendSMS-XMLPOST.ps1</ScriptName>
    <Arguments />
    <ScriptBody>function SendSMS{
    param([string]$url, [int]$customer, [string]$login, [string]$password, [string]$recipient, [string]$sender, [string]$message, [string]$reference)
    $xml = New-Object XML
    $messages = $xml.CreateElement("MESSAGES")

    Vladimir,
    Thanks for your response.
    Ofcourse i can. Here you got my XML. These are my changes to the XML:
    In the typedefenitions -> moduletypes:
    <ModuleTypes>
    <!-- ABO ADDED code 18-07-2014 -->
    <WriteActionModuleType ID="Microsoft.Windows.PowerShellWriteAction" Accessibility="Public" Batching="false">
    <Configuration>
    <IncludeSchemaTypes>
    <SchemaType>Microsoft.Windows.PowerShellSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element name="ScriptName" type="NonNullString" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="ScriptBody" type="NonNullString" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="SnapIns" type="SnapInsType" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="Parameters" type="NamedParametersType" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="TimeoutSeconds" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="StrictErrorHandling" type="xsd:boolean" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="SerializationDepth" type="xsd:integer" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    </Configuration>
    <OverrideableParameters>
    <OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
    </OverrideableParameters>
    <ModuleImplementation Isolation="Any">
    <Composite>
    <MemberModules>
    <WriteAction ID="PowerShellWriteAction" TypeID="Microsoft.Windows.PowerShellWriteActionBase">
    <ScriptName>$Config/ScriptName$</ScriptName>
    <ScriptBody>$Config/ScriptBody$</ScriptBody>
    <SnapIns>$Config/SnapIns$</SnapIns>
    <Parameters>$Config/Parameters$</Parameters>
    <TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
    <OutputType>SerializedObjectData_OpsMgrSerialization</OutputType>
    <StrictErrorHandling>$Config/StrictErrorHandling$</StrictErrorHandling>
    <SerializationDepth>$Config/SerializationDepth$</SerializationDepth>
    </WriteAction>
    </MemberModules>
    <Composition>
    <Node ID="PowerShellWriteAction" />
    </Composition>
    </Composite>
    </ModuleImplementation>
    <OutputType>Microsoft.Windows.SerializedObjectData</OutputType>
    <InputType>System!System.BaseData</InputType>
    </WriteActionModuleType>
    <WriteActionModuleType ID="Microsoft.Windows.PowerShellWriteActionBase" Accessibility="Internal" Batching="false">
    <Configuration>
    <IncludeSchemaTypes>
    <SchemaType>Microsoft.Windows.PowerShellSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element name="ScriptName" type="NonNullString" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="ScriptBody" type="NonNullString" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="SnapIns" type="SnapInsType" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="Parameters" type="NamedParametersType" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="TimeoutSeconds" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="OutputType" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="SerializedObjectData_OpsMgrSerialization" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="StrictErrorHandling" type="xsd:boolean" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    <xsd:element name="SerializationDepth" type="xsd:integer" minOccurs="0" maxOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
    </Configuration>
    <ModuleImplementation Isolation="Any">
    <Managed>
    <Assembly>Microsoft.EnterpriseManagement.Modules.PowerShell, Culture="", PublicKeyToken="31bf3856ad364e35", Version="6.0.4900.0"</Assembly>
    <Type>Microsoft.EnterpriseManagement.Modules.PowerShell.PowerShellProbeActionModule</Type>
    </Managed>
    </ModuleImplementation>
    <OutputType>Microsoft.Windows.SerializedObjectData</OutputType>
    <InputType>System!System.BaseData</InputType>
    </WriteActionModuleType>
    </ModuleTypes>
    <!-- ABO ADDED code 18-07-2014 -->
    And in the monitor recovery:
    <!-- ABO ADDED code 18-07-2014 -->
    <Recovery ID="MomUIGenaratedRecovery7187d8e283b44c9c9a115f06af5d3dcc" Accessibility="Public" Enabled="true" Target="MPAuthoring.PowerShellScript.ServiceTarget" Monitor="MPAuthoring.PowerShellScript.ServiceMonitor" ResetMonitor="false" ExecuteOnState="Warning" Remotable="true" Timeout="300">
    <Category>Custom</Category>
    <WriteAction ID="ServiceRestartScriptWriteAction" TypeID="Windows!Microsoft.Windows.PowerShellWriteAction">
    <ScriptName>SendSMS-XMLPOST.ps1</ScriptName>
    <Arguments />
    <ScriptBody>function SendSMS{
    param([string]$url, [int]$customer, [string]$login, [string]$password, [string]$recipient, [string]$sender, [string]$message, [string]$reference)
    $xml = New-Object XML
    $messages = $xml.CreateElement("MESSAGES")
    $customerxml = $xml.CreateElement("CUSTOMER")
    $customerxml.SetAttribute("ID", $customer)
    $messages.AppendChild($customerxml)|Out-Null
    $user = $xml.CreateElement("USER")
    $user.SetAttribute("LOGIN", $login)
    $user.SetAttribute("PASSWORD", $password)
    $messages.AppendChild($user) |Out-Null
    if (!($reference.Equals(''))) {
    $refxml = $xml.CreateElement("REFERENCE")
    $refxml.Innertext = $reference
    $messages.AppendChild($refxml) |Out-Null
    $tariff = $xml.CreateElement("TARIFF")
    $tariff.InnerText = 0
    $messages.AppendChild($tariff) |Out-Null
    $msg = $xml.CreateElement("MSG")
    $from = $xml.CreateElement("FROM")
    $from.InnerText = $sender
    $msg.AppendChild($from) |Out-Null
    $to = $xml.CreateElement("TO")
    $to.InnerText = $recipient
    $msg.AppendChild($to) |Out-Null
    $body = $xml.CreateElement("BODY")
    $body.SetAttribute("TYPE", "TEXT")
    $body.InnerText = $message
    $msg.AppendChild($body) |Out-Null
    $messages.AppendChild($msg) |Out-Null
    $xml.AppendChild($messages) |Out-Null
    Write-Output $xml.OuterXml
    $webClient = New-Object net.WebClient
    return ($webClient.UploadString($url, $xml.OuterXml))
    # test
    SendSMS -url 'https://sms.nl/' -recipient 0031123456789 -customer 1 -login 1 -password 'password' -sender 'Standby' -message 'Test' -reference '1234'</ScriptBody>
    <!-- ABO ADDED code 18-07-2014 -->

  • HDD RPM using powershell

    Hey guys,
    Do we have script with which i can pull HDD RPM of my remote server by using PowerShell script? i tried to check via WMI object, but couldn't get any clue related to HDD RPM. 
    Thank you.

    You can use Get-PhysicalDisk retrieve disk info. The returned MSFT_PhysicalDisk object has SpindleSpeed property, indicating rotation speed for rotating disks, but not all rotating disks provide this information. 
    Gleb.

  • How to excute a power shell script to remote machine using power shell script folder path and script name

    Hi,
    Let say, I have 3 parameters.
    1. Script FolderPath (Remote path for e.g \\RD101\ScriptSharedFolder     Here RD101 is one server)
    2. Script Name(StopAllService.ps1)
    3. Server Name (RD45)
    I want to execute a powershell scritp in my local machine(Test1)  and in that script I want to pass the above three parameters.Now I want to excute the StopAllService.ps1 script into RD45 server. But the script is available in RD101 machine.
    So What I want to here How can we do this ? I have script name and script folder path and target execution server name.
    Pls giude me or give me the script.
    By
    A Path Finder..
    JoSwa 
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Hi,
    You got 2 solutions for your problem:
    1- If you have permission to run scripts in the remote computer without specifying your credential,
    then, the first reply solve your problem.
    2- If you have permission to run scripts in the remote computer
    having to specify your credential, l then,
    my solution solves your problem.
    If the remote computer requires signed scripts only, you need signed script. Period. Or are you trying to break remote computer security?
    If you need signed script, there's no psdrive that'll circumvent such requirement.
    The problem is that the execution policy is set to "RemoteSigned". Using the URL explicitly tags that script as being from a remote source, and the policy blocks it.  The PSDrive provides a local reference for the script.  It does not
    sign the script but the local drive reference may prevent it from being blocked for being from a remote source. I'll test that later.
    Script signing is not and should never be considered a security measure. It is easily circumvented by running the script using powershell.exe, and using the -ExecutionPolicy parameter to override whatever the local execution policy setting is. 
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Maybe you are looking for

  • When i try to open itunes it won't open(non error msg without norton)

    When i double click the icon on my desktop itunes won't open. When i go to start > programs > itunes > itunes it will not load either. I do not even get an error message.All i see is a time glass for just a second. And i do not have norton on my comp

  • HP Officejet and PSC Full Feature Software for HP PSC 1210 All in one printer

    Hello ,              I have  HP PSC 1210 All in one printer but i am using windows 7 system.how can i find                                                                             'HP Officejet and PSC Full Feature Software' compatible for windows

  • PDF printer driver file naming issue

    Hello, I'm not sure if I'm in the right place for this question but here goes. When I use the PDF printer driver to "print" a PDF file from InDesign or Illustrator, the file name is appended with extra information I don't want. For example, I want ju

  • How do i do a mail merge for labels

    I would like to create labels in a Pages document using a Numbers document for the data.  I have it all set up, but upon completing the merge, I get an entire page of the same label (same fields), the next page of labels contains 30 copies of the 2nd

  • Business packages for real estate

    Hi,   Any one know whether we have any business packages for real estate.If anyone know please send me the link or mail documentation to this mail id [email protected] Thanks, kumar