Powershell error

Hey Tech Bros,
Not sure whether this is the right forum.I get error while executing the job status report script.
#Create a new Excel object using COM
$Excel = New-Object -ComObject Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()
$Sheet = $Excel.Worksheets.Item(1)
#Counter variable for rows
$intRow = 1
#Read thru the contents of the SQL_Servers.txt file
foreach ($instance in get-content "C:\SQLCheck\Serverlist.txt")
#Create column headers
$Sheet.Cells.Item($intRow,1) = "INSTANCE NAME:"
$Sheet.Cells.Item($intRow,2) = $instance
$Sheet.Cells.Item($intRow,1).Font.Bold = $True
$Sheet.Cells.Item($intRow,2).Font.Bold = $True
$intRow++
$Sheet.Cells.Item($intRow,1) = "JOB NAME"
$Sheet.Cells.Item($intRow,2) = "LAST RUN OUTCOME"
$Sheet.Cells.Item($intRow,3) = "LAST RUN DATE"
#Format the column headers
for ($col = 1; $col –le 3; $col++)
$Sheet.Cells.Item($intRow,$col).Font.Bold = $True
$Sheet.Cells.Item($intRow,$col).Interior.ColorIndex = 48
$Sheet.Cells.Item($intRow,$col).Font.ColorIndex = 34
$intRow++
#This script gets SQL Server Agent job status information using PowerShell
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
# Create an SMO connection to the instance
$srv = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $instance
$jobs=$srv.JobServer.Jobs -like "TCB*"
#Formatting using Excel
ForEach ($job in $jobs)
# Formatting for the failed jobs
if ($job.LastRunOutcome -eq 0)
$fgColor = 3
else
$fgColor = 0
$Sheet.Cells.Item($intRow, 1) = $job.Name
$Sheet.Cells.Item($intRow, 2) = $job.LastRunOutcome.ToString()
$Sheet.Cells.item($intRow, 2).Interior.ColorIndex = $fgColor
$Sheet.Cells.Item($intRow, 3) = $job.LastRunDate
$intRow ++
$intRow ++
$Sheet.UsedRange.EntireColumn.AutoFit()
cls
Best Regards, Arun http://whynotsql.blogspot.com/

Can you try the below code?
#Create a new Excel object using COM
$Excel = New-Object -ComObject Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()
$Sheet = $Excel.Worksheets.Item(1)
#Counter variable for rows
$intRow = 1
#Read thru the contents of the SQL_Servers.txt file
foreach ($instance in get-content "C:\Server.txt")
#Create column headers
$Sheet.Cells.Item($intRow,1) = "INSTANCE NAME:"
$Sheet.Cells.Item($intRow,2) = $instance
$Sheet.Cells.Item($intRow,1).Font.Bold = $True
$Sheet.Cells.Item($intRow,2).Font.Bold = $True
$intRow++
$Sheet.Cells.Item($intRow,1) = "JOB NAME"
$Sheet.Cells.Item($intRow,2) = "LAST RUN OUTCOME"
$Sheet.Cells.Item($intRow,3) = "LAST RUN DATE"
#Format the column headers
for ($col = 1; $col –le 3; $col++)
$Sheet.Cells.Item($intRow,$col).Font.Bold = $True
$Sheet.Cells.Item($intRow,$col).Interior.ColorIndex = 48
$Sheet.Cells.Item($intRow,$col).Font.ColorIndex = 34
$intRow++
#This script gets SQL Server Agent job status information using PowerShell
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null
# Create an SMO connection to the instance
$srv = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $instance
$jobs=$srv.JobServer.Jobs | Where-Object {$_.IsEnabled -eq $TRUE -and $_.name -like '*Job*'} | Select Name,LastRunOutcome, LastRunDate
if($jobs -eq $null)
{write-output 'No jobs found'
else
#Formatting using Excel
ForEach ($job in $jobs)
# Formatting for the failed jobs
if ($job.LastRunOutcome -eq 0)
$fgColor = 3
else
$fgColor = 0
$Sheet.Cells.Item($intRow, 1) = $job.Name
$Sheet.Cells.Item($intRow, 2) = $job.LastRunOutcome
$Sheet.Cells.item($intRow, 2).Interior.ColorIndex = $fgColor
$Sheet.Cells.Item($intRow, 3) = $job.LastRunDate
$intRow ++
$intRow ++
$Sheet.UsedRange.EntireColumn.AutoFit()
--PRashanth

Similar Messages

  • Powershell error while importing module and executing function from module

    powershell error while importing module and executing function from module
    Function called in uncertain order..
    VERBOSE: The 'Function1' command in the MyModule module was imported, but because its name does not include an approved verb, it might be difficult to find. The
    suggested alternative verbs are "Clear, Install, Publish, Unlock".
    VERBOSE: Importing function 'Function1'.
    VERBOSE: The 'Function2' command in the MyModule' module was imported, but because its name does not include an approved verb, it might be difficult to fin
    d. For a list of approved verbs, type Get-Verb.
    VERBOSE: Importing function 'Function2'.

    First of all those errors look more related to HBR, though if it worked before I would restart services then log into the planning app and then try again.
    Have you tried a different form as well one without an ampersand &.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Powershell Error for SharePoint Online -"The remote server returned an error: (407) Proxy Authentication Required."

    I am trying to call sharepoint online from powershell. Below is the code. I get 
    Exception calling "ExecuteQuery" with "0" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
    $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
    $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
    $webUrl = "ZZZZ"
    $username = "XXX"
    $password = "YYYY"
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl) 
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $web = $ctx.Web
    $lists = $web.Lists 
    $ctx.Load($lists)
    $ctx.ExecuteQuery()
    $lists| select -Property Title
    Raj-Shpt

    Hi,
    About how to access SharePoint online site using PowerShell, the blog below would be helpful:
    http://social.technet.microsoft.com/wiki/contents/articles/29518.csom-sharepoint-powershell-reference-and-example-codes.aspx
    Another two demos for your reference:
    http://www.hartsteve.com/2013/06/sharepoint-online-powershell/
    http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in-PowerShell-scripts-with-Office365.html
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Cloud Service: Powershell Error while waiting for Role to Start

    Hi,
    I have the below code when trying the deploy a cloud service with Powershell using New-AzureDeployment.
    How can i get over this. This happens every once in say five instance of deployment.
    System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.N
    et.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected ho
    st has failed to respond xx.xxx.xxx.xxx:443
       at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, 
    Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
       at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
       --- End of inner exception stack trace ---
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
       at Microsoft.WindowsAzure.Management.Storage.StorageAccountOperationsExtensions.Get(IStorageAccountOperations operations, String accountName)
       at Microsoft.WindowsAzure.Commands.Common.Storage.StorageUtilities.GenerateCloudStorageAccount(StorageManagementClient storageClient, String accountName)
       at Microsoft.WindowsAzure.Commands.Utilities.Common.WindowsAzureSubscriptionExtensions.GetCloudStorageAccount(AzureSubscription subscription)
       at Microsoft.WindowsAzure.Commands.Storage.Common.StorageCloudCmdletBase`1.GetStorageAccountFromSubscription()
       at Microsoft.WindowsAzure.Commands.Storage.Common.StorageCloudCmdletBase`1.GetCmdletStorageContext()
    Thanks,
    Pradebban Raja

    Hi,
    Please have a check on the below blog and check if it helps.
    http://blogs.msdn.com/b/narahari/archive/2011/12/21/azure-a-connection-attempt-failed-because-the-connected-party-did-not-properly-respond-after-a-period-of-time-or-established-connection-failed-because-connected-host-has-failed-to-respond-x-x-x-x-x-quot.aspx
    Regards,
    Mekh.

  • SQL query in powershell Errors on IIF

    Hello,
    I have put together a Powershell script from examples online to run a SQL query.  The query came from Access and it seems Powershell has a problem with the syntax.
    I'm pretty new to scripting and adding SQL to the equation isn't helping.
    Powershell code
    $SQLServer = "ServerName"
    $SQLDBName = "DataBase"
    $SqlQuery = 'MyQuery'
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"
    $SqlCmd = New-Object System.Data.SqlClient.SqlCommand
    $SqlCmd.CommandText = $SqlQuery
    $SqlCmd.Connection = $SqlConnection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet)
    $SqlConnection.Close()
    $DataSet.Tables[0] | ft -AutoSize
    SQL Query
    SELECT swName AS Server, swRack AS Rack, swEnvironment AS Environment, IIf([dbo.SW_SERVICE_LVL].[swMonday]=1,"Mon") AS [RebootSchedule], dbo.SW_SERVICE_LVL.swMonBeginTime AS [RebootTime], 2 AS Expr
    FROM dbo.SW_SERVICE_LVL INNER JOIN dbo.SW_SPECIALTY ON dbo.SW_SERVICE_LVL.swDiscount = dbo.SW_SPECIALTY.swSpecialtyId
    WHERE (((IIf([dbo.SW_SERVICE_LVL].[swMonday]=1,"Mon")) Is Not Null) AND ((dbo.SW_SERVICE_LVL.swGrpResp)="IT Group Name") AND ((dbo.SW_SERVICE_LVL.swRootObjectType)="Server"));
    Error given is
    Exception calling "Fill" with "1" argument(s): "Incorrect syntax near ')'.
    Incorrect syntax near 'IIf'."At line:16 char:1
    + $SqlAdapter.Fill($DataSet)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : SqlException

    This might be considered a new question but now I got the powershell code to return data from the SQL database.
    Now I am looking to output the table to a powershell Array then append the LastRebootTime into that Array.  As far as I can tell, this requires a ForEach loop on each servername returned from the SQL query.  And I'm stuck on getting that working.
    Stop thinking like you know what that means.
    Where are you getting lastreboottime? Why does it have to be appended.  "Reboottime" is one of thefields in or query.  You don't need it.
    ¯\_(ツ)_/¯
    That is a bit strongly worded.  Here's what I've got and this is still a work in progress.  I've said this before, I am not a scripter.  Now I am stuck on adding the LastBootUpTime column into the table returned from the SQL query.
    $SQLServer = "ServerName"
    $SQLDBName = "DataBase"
    $SqlQuery = 'MyQuery'
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection
    $SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"
    $SqlCmd = New-Object System.Data.SqlClient.SqlCommand
    $SqlCmd.CommandText = $SqlQuery
    $SqlCmd.Connection = $SqlConnection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet) | Out-Null
    $arraydata = @($DataSet)
    $SqlConnection.Close()
    $servers = @($DataSet.Tables[0]) | select -ExpandProperty Server
    Try{
    foreach ($server in $servers)
    $arraydata += @(GWMI -ComputerName $server -Class Win32_OperatingSystem -ErrorAction SilentlyContinue | select @{LABEL="Server";Expression={$_."csname"}}, @{LABEL='LastBootUpTime'
    ;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}})
    }#end try
    Catch{
    "Can't work with $server"
    $DataSet.Tables[0] | ft -AutoSize #Export-Csv -NoTypeInformation -Path c:\sunday.csv
    $arraydata

  • Powershell error: 'Get-AzureRole' is not recognized as the name of a cmdlet

    I am trying to
     get PIP information on all instances of a role using Windows PowerShell
    as per the document - "https://msdn.microsoft.com/library/azure/dn690118.aspx"
    When I execute the command in the doc in the powershell:
    Get-AzureRole -ServiceName FTPInAzure -Slot Production -InstanceDetails
    The following error msg pops up:
    'Get-AzureRole' is not recognized as the name of a cmdlet.
    what's wrong?
    Thanks
    Thank you Morris

    Hi,
    Thanks for posting !
    I am currently researching to gather more information which might take some time and hence will get back to you shortly.
    Appreciate your time and patience.
    Regards,
    Sowmya

  • Merging vhdx & .avhdx with powershell error ....

    i m trying to merge a vhdx & avhdx with powershell
    the codes are
    Run diskpart.
    Enter: select vdisk file="<full path to the latest differencing disk>"
    A differencing disk ends in either .avhd or .avhdx.
    Enter: merge vdisk depth=n
    n will be the number of parent files you want to merge.  Since I had two parents, one .vhd and one .avhd for this .avhd file, I used depth=2.
    the problem is whenever i try to select the differencing disk in step 2 , i get an error ...device not ready
    if i changed the avhdx to vhdx ... i get the same error
    i unchecked the read only ... gave full permissions to vm machine and user ... still get error
    please advice or if you suggest a third party that can migrate the vhdx with its avhdx

    You will need a backup to go back to a valid database.
    Snapshots are not supported in Production and cause in few cases  issues and behaviour like you are encoutering now.
    You have to avoid using snapshots in production, snapshots are nice and they unction propely in 99% of the cases. You were not lucky. If you want to use snapshots with a VM for a reason (test update or a  new configuration),  backup your VM before.
    Regards, Samir Farhat Infrastructure and Virtualization Consultant || Virtualization, Cloud, Azure ? Follow and Ask here https://buildwindows.wordpress.com

  • FIM Powershell error

    hello, 
    i try to update a custom object with Powershell in FIM and i have this error 
    Any idea ? 
    Regards

    Hello,
    hard to say from the above error, I'm wondering about the File IO error.
    In generell custom objects are not different from the Default objects.
    User running Powershell must have Access to Portal/webservice and grant rights with MPRs to the custom objects.
    Keep also in mind that objecttypes System names are case-sensitive.
    Maybe some relevant parts of the script could help, if ist a Scripting error.
    -Peter
    Peter Stapf - ExpertCircle GmbH - My blog:
    JustIDM.wordpress.com

  • Execute C# in PowerShell: errors with " using System.XML "

    Hi , I'm trying to execute C# code in Power Shell 2.0 .
    My problem is for the references  at the beginning of the code:
    $code = @"
    using System;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Xml;
    using System.Xml.Linq;
       public class Program
            static void Main()
            {  /* the code wich works*/
    Add-Type  -TypeDefinition $code -Language "CSharpVersion3"
    Powershell give me an error saying that " The type or namespace Linq doesn't exist" , and the same for Xml. I have Visual studio express 2013 .
    How can add or import correctly those references? or what is my error?

    Hi Rebegg,
    As this issue is related to Visual Studio, I suggest you create a new thread on Visual Studio forum, more experts will assist you with this issue.
    Visual Studio forum:
    http://social.msdn.microsoft.com/Forums/en-US/home?category=visualstudio
    In addition, about this issue, you have to add your  assemblies to your PowerShellsession before you can reference them to you C# Code, you can use the script like:
    $Assem = (
    ...add referenced assemblies here...
    $Source = @"
    ...add C# source code here...
    Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source -Language CSharp
    Here are some similar posts for your reference:
    http://ruudvanderlinden.com/2010/10/19/running-inline-c-with-custom-assemblies-in-powershell-2-0/
    http://powershell.com/cs/media/p/133.aspx
    http://blogs.technet.com/b/stefan_gossner/archive/2010/05/07/using-csharp-c-code-in-powershell-scripts.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • PowerShell Error 401 Unauthorised when connect to SPO 365

    Hi guys,
    please help on connecting via PowerShell to our corporate SharePoint Online;
    I use the
    PS > Connect-SPOService -Url https://corp-admin.sharepoint.com/ -Credential me(AT)corp.com  
    and when asked for password, I type in the correct one for the account and get
    connect-sposervice : The remote server returned an error: (401) Unauthorized.
    (When I type in password which is not correct, there is different reply
    Connect-SPOService : The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios.
    thus I guess the auth phase works fine on AD.)
    Haven't found any useable reply on forums.
    Thank you in advance for any advice,
    Michal

    Hi
    use this link
    http://www.amintavakoli.com/2011/12/install-microsoft-online-services.html
    It's working ;)
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • Web Services and Powershell error: Method can not be reflected

    I'm trying to use the VSM 9.1 Web Service API with Powershell, however when I run the New-WebServiceProxy cmdlet it throws an error, the inner exception being "Method InfraAPI.KnowledgeUpdate can not be reflected.", and as such I'm unable to proceed any further with development.
    Here's the Powershell output:
    PS C:\PS> new-webserviceproxy -uri http://vsmhost/dev/ServiceManager.svc?wsdl
    New-WebServiceProxy : Exception has been thrown by the target of an invocation.
    At line:1 char:20
    + new-webserviceproxy <<<<  -uri http://vsmhost/dev/ServiceManager.svc?wsdl
        + CategoryInfo          : NotSpecified: (:) [New-WebServiceProxy], TargetInvocationException
        + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Microsoft.PowerShell.Commands.NewWebServiceProxy
    PS C:\PS> $error[0].exception.innerexception
    Method InfraAPI.KnowledgeUpdate can not be reflected.
    Any help with this would be greatly appreciated.

    Hi Chris,
    //-- Please read the following as my personal opinion only as it's based only on my own experience using VSM API. I may be wrong of course. --//
    As far as I remember there was never a good decision to use VSM API through web service reference.
    I had met some problems when referencing VSM services directly through web even using Visual Studio some years ago. Since then I don't use this method.
    Recently I have tried to check VSM API services metadata with some soap tools and it appears that it is not completely WS-I compliant - something wrong with namespaces defining ResultSet elements as type of DataSet. Perhaps this is the reason why VSM web services does not work as expected when referencing them directly. Maybe something else...
    So the solution, workaround actually, (provided by VMware by the way) is to generate InfraAPI class and use it in your project. So far no problems with this method and we are using VSM API quite a lot.
    In any case, it could be really helpful if someone might submit this issue to Alemba to fix it permanently I guess.
    Ok, let's go back to your question about using VSM API with PowerShell. I must admit you have really challenged me. It was not so simple but really interesting.
    The only way I have made PowerShell working is this:
    1. Extract VSM API services class to a file:
    svcutil /t:code /language=c# /messageContract http://vsmhost/dev/ServiceManager.svc /out:InfraAPI.9.2.0.cs /config:InfraAPI.9.2.0.config
    2. Compile the class to dll file:
    csc /t:library /out:InfraAPI.9.2.0.dll InfraAPI.9.2.0.cs
    3. Include and use this library in your ps script like this:
    [System.Reflection.Assembly]::LoadFrom("C:\_DATA\__SM9\PowerShell\API\InfraAPI.9.2.0.dll")
    [System.Reflection.Assembly]::LoadWithPartialName(“System.ServiceModel”)
    $ws_hb = New-Object System.ServiceModel.BasicHttpBinding
    $ws_hb.Name = "BasicHttpBinding_IServiceManager"
    $ws_epa = New-Object System.ServiceModel.EndpointAddress("http://vsmhost/dev/servicemanager.svc")
    $ws = New-Object ServiceManagerClient($ws_hb,$ws_epa)
    $ws_login_in = New-Object LoginRequest("VSM_USER_NAME","VSM_USER_PASSWORD","VSM_DATABASE")
    $ws_login_out = $ws.Login($ws_login_in)
    $ws_login_out.sMessage
    if($ws_login_out.Ret.value__ -eq 0){
        "Session ID: " + $ws_login_out.sID
        $ws_logout_in = New-Object LogoutRequest($ws_login_out.sID)
        $ws.Logout($ws_logout_in).sMessage
    Shoot your questions if you have any. And could you please let me know if this is working in your environment. Tx.
    Regards, Gytis

  • Remote PowerShell Error: Value cannot be null

    I am trying to run commands on our exchange server from another server, and I keep running into this problem regard less of the command I run.  For example I am trying to run the New-MailboxExportRequest and I alway get the error "Value cannot be null."
     If I run the command from the exchange server console it works fine.
    the client machine is Server 2008 (x86) and the server is Server 2008 R2 (x64).
    Here is the exact log of what I am doing
    Windows PowerShell
    Copyright (C) 2009 Microsoft Corporation. All rights reserved.
    PS C:\Users\Administrator> Enter-PSSession -computerName SAM
    [sam]: PS C:\Users\Administrator\Documents> Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
    [sam]: PS C:\Users\Administrator\Documents> new-mailboxexportRequest
    cmdlet New-MailboxExportRequest at command pipeline position 1
    Supply values for the following parameters:
    Mailbox: eric
    FilePath: C:\Test\eric.pst
    Value cannot be null.
    Parameter name: parameters
    + CategoryInfo :
    + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
    [sam]: PS C:\Users\Administrator\Documents>
    It seems that almost all the exchange commands do not work using this connection method.  Can any one tell me what I am missing?

    Have the remote powershell ever worked before?
    Have you tried to use the procedure in the article below to connect the remote exchange server?
    Connect Remote Exchange Management Shell to an Exchange Server
    James Luo
    TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx)
    If you have any feedback on our support, please contact [email protected]

  • Wbadmin in powershell: ERROR - Command syntax incorrect. Error: Component'. See the command

    Hello,
     I want to backup server from  powershell script:
    wbadmin
    start
    backup
    -backuptarget:\\?\Volume{3651776b-fc60-4ccb-af2b-48b702256f55}
    -hyperv:"ComputerName1,Host
    Component" -vssfull
    -quiet
    but I am gettting following error:
    ERROR - Command syntax incorrect. Error: Component'. See the command
    syntax below.
    In CMD it works fine but I am unable to get it working in PS. Can anyone help? Thank you.
    Pete
    sfs

    Please see the following article for how to pass arguments for executables in PowerShell:
    Windows IT Pro: Running Executables in PowerShell
    Basically all you should need to do is quote the entire argument to the -backuptarget parameter, as in:
    "-backuptarget:\\?\Volume{3651776b-fc60-4ccb-af2b-48b702256f55}"
    You probably also need to quote the entire -hyperv argument as well:
    "-hyperv:ComputerName1,Host Component"
    You can use the ShowArgs.exe tool in the article download to see the actual command line that PowerShell is really passing to the executable.
    -- Bill Stewart [Bill_Stewart]

  • Powershell Error when trying to delete a single document

    Hello,
    I am trying to delete a single file named test in my library named testtesttest and I am not able to do so with Powershell. Could someone assist?
    $web = get-spweb "http://Webapp/sites/knowledgebase/test3/"
    $list = $web.lists["testtesttest"]
    $item = $list.item | ?{$_.name -eq "test"}
    $item.delete()

    Name in a library includes the FileExtension as well. Also, the script should be something like below:
    $spAssgn = Start-SPAssignment;
    $web = Get-SPWeb "<URL>" -AssignmentCollection $spAssgn;
    $list = $web.Lists["testtesttest"];
    $item = $list.Items|?{$_.Name -eq "test.docx"};
    #Check if $item exists and is not null
    if($item){
    $list.GetItemById($item.ID).Delete();
    Stop-SPAssignment $spAssgn;
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Upgrade to 2008 from 2003 stopped by powershell error

    I am trying to do an upgrade to 2008 32bit from 2003 R2.  When it run the check it says it can not continue because powershell is installed.  I did a search on this and found a KB article that talked about going into add/remove programs and select
    show updates.  Then find a specific updates and uninstall it or go to the windows directory and into the number and run the uninstaller.  The problem is that one doesn't show up in the add/remove programs or in windows director either.  So I
    am not sure what to do now so that I can get the upgrade to run.
    Thanks
    Martin

    Hi,
    Please reinstall Windows PowerShell 1.0 to repair it and try to uninstall it again.
    If it does not work, I would like to suggest you use Process Monitor to monitor the installation process of Windows PowerShell 1.0. In
    this way, you will know what files, folders and registries are installed. After that, please manually remove them.
    Windows PowerShell 1.0 English-Language Installation Package for Windows Server 2003 (KB926139)
    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=10ee29af-7c3a-4057-8367-c9c1dab6e2bf
    Process Monitor v2.94
    http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
    Regards,
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

Maybe you are looking for

  • Get page size using vuebean etc api

    Hi We are trying to scale markup entities to a fixed size and we can use getPageExtents() but this does not appear to be in real world coordinates eg 11.7" by 8.3". Please advise how scaling works and where we can get the scale factors in the api. Th

  • Oracle database on windows without oracle service

    Hi Gurus, I noticed that one oracle database exist on Windows server without oracle service. Is this possible to create a database without service on windows server? What would be the next step to create a service for the existing databse. Please hel

  • PSE 9 bug

    I have pse 9. In photoshop I am getting frequent lockups after trying to save after an edit.  I click on 'save as' and nothing happens.  'Save as' again and it works, but after ther save the system locks up.  I have to shut it down usung task manager

  • PSA data cannot be seen error

    Hi all, I am getting one differnt error when tried to see PSA data in production system. When clicked on PSA and selected request to see data it gives following eoor screen <b>An internal error occurred in the data maintenance module Diagnosis An int

  • Submit LabView Cluster to Word macro

    Hello, I want to run a word macro (Test100) from LabView and therefor its neccesary to submit the following argument (NewTable) to word: Type BookType     KeyIn As String     ValueIn As String End Type Type PSEXTable     TKey As String     TValue(0 T