Unable to remove ??? this line from default.aspx using powershell

Trying to open the default.aspx page using powershell script
$file =  $spSourceWeb.GetFile("default.aspx")
 $datastring = [System.Text.Encoding]::ASCII.GetString($file.OpenBinary()) 
in the content I am getting three ??? char because of this site is breaking . how to avoid this or remove .please provide your suggestion on this .
sarav

I am tring to download the default.aspx page from subsite  then remove some bad reference from default.aspx then then again planning to update.
My code here
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
  Add-PSSnapin Microsoft.SharePoint.PowerShell;
try
    #set the admin url
    $sourceWebURL = "My url"   
    $spSourceWeb = Get-SPWeb $sourceWebURL
    $file =  $spSourceWeb.GetFile("default.aspx")   
    if ($file.ForceCheckout)
        $file.CheckOut()
    #download files
    $datastring = [System.Text.Encoding]::ASCII.GetString($file.OpenBinary())     
    $strFinder = '<%@ Register TagPrefix="WpNs1" Namespace="BD.Evolve.DHFQueryWebPart" Assembly="BD.Evolve.DHFQueryWebPart, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=709ed70a96eaa5cb"%>'
    $strReplace =''   
   # Need to replace ???
    $strFinder1="???"
    #Write-Host $strFinder1    
    #$datastring=$datastring -Replace($strFinder1,$strReplace)
    $datastring=$datastring -Replace($strFinder,$strReplace) 
    $file.SaveBinary([System.Text.Encoding]::ASCII.GetBytes($datastring))   
    if($file.CheckedOutBy.LoginName -eq 'my adminid')
     $file.CheckIn('myadminid');
    Write-Host $datastring
catch
        Write-Host "error "+$error[0]
sarav

Similar Messages

  • Unable to remove this item from GRIR.  It was a consignment PO receipt done

    Hi Guys,
    The user saying that"unable to remove this item from GRIR.  It was a consignment PO receipt done improperly, so it needs to be deleted".
    Because of this the the material documet which shows $6725.43-(Negative) in GRIR account.when i check this this transation was originated through MI10(Physical inventory differenvces posting).May be user done wrongly.
    Now the problem is this
    -          how this transaction originated?
    -          Why is this posted to GR/IR account?
    -          How do we correct the open item in the GR/IR account?
    -          What need to happen to rectify the mistake?
    can any tell me how can we do this,i will be greatful to u.
    Thanks&Regards,
    Babu,
    09930154536

    Hi Jurgen,
    when i check the material document and accounting document,it was showing that said amount in negative sign and transaction done by MI10 means posted differences with out reference to document.
    it means the user may entered wrongly i think.
    was there any GRIR account for MI10?
    MI10 does not have reversal or cancel?
    so how to resolve it?
    as per my idea it can be done by FI posting.
    please help to resolve.
    Thanks in advance.
    Regards,
    Babu
    09930154536

  • How to remove HTML encoding from csv file using powershell

    Hi guys i am exporting data from a sharepoint list using powershell which works fine. My problem is that some of the fields contain HTML mark up. Is there a way to remove all of the html mark up from the array before writing it to csv ?
    I have tried playing about with System.Web.HttpUtility.HtmlDecode but with no luck the code runs but no html is removed.
    Below is a sample of my script.
    Set-Variable HOME $env:USERPROFILE -Force
    (Get-PSProvider FileSystem).Home = $HOME
    if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"}))
    Add-PSSnapin Microsoft.SharePoint.PowerShell;
    # imports assembly needed for url stuff to do
    Add-Type -AssemblyName System.Web
    $SPWeb = Get-SPWeb "http://site url"
    $SPList = $SPWeb.Lists["List Name"]
    $exportlist = @()
    $SPList.Items | foreach {
    $obj = New-Object PSObject -Property @{
    "Employee full name" = $_["EMPLOYEEFNAME"]
    "Employee login name" = $_["EMPLOYEENAME"]
    "Department Name" = $_["DEPARTMENT"]
    System.Web.HttpUtility.HtmlDecode("OBJECTIVESTOBEACHIEVED_0") = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_0"]
    "OBJECTIVESTOBEACHIEVED_1" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_1"]
    "OBJECTIVESTOBEACHIEVED_2" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_2"]
    "OBJECTIVESTOBEACHIEVED_3" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_3"]
    "OBJECTIVESTOBEACHIEVED_4" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_4"]
    "OBJECTIVESTOBEACHIEVED_5" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_5"]
    "OBJECTIVESTOBEACHIEVED_6" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_6"]
    "OBJECTIVESTOBEACHIEVED_7" = $_["F1_S4a_OBJECTIVESTOBEACHIEVED_7"]
    $exportlist += $obj
    $exportlist | select "Employee full name", "Employee login name", "Department Name", "OBJECTIVESTOBEACHIEVED_0", "OBJECTIVESTOBEACHIEVED_1", "OBJECTIVESTOBEACHIEVED_2", "OBJECTIVESTOBEACHIEVED_3", "OBJECTIVESTOBEACHIEVED_4", "OBJECTIVESTOBEACHIEVED_5", "OBJECTIVESTOBEACHIEVED_6", "OBJECTIVESTOBEACHIEVED_7" | Export-Csv ~/Export.csv -noType
    $SPWeb.Dispose()
    any help would be much appreciated.

    Should have googled before posting !
    "OBJECTIVESTOBEACHIEVED_0" = [Microsoft.SharePoint.Utilities.SPHttpUtility]::ConvertSimpleHtmlToText($_["F1_S4a_OBJECTIVESTOBEACHIEVED_0"],-1) -replace '\s+', ' '
    Clears all the additional white space. As always jrv you
    have saved the day, many thanks for all the help.
    Mal

  • Unable to remove a host from VMM - Error (2606) Unable to perform the job because one or more of the selected objects are locked by another job.

    I am unable to remove a host from my Virtual Machine Manager 2012 R2. I receive the following error:
    Error (2606)
    Unable to perform the job because one or more of the selected objects are locked by another job.
    Recommended Action
    To find out which job is locking the object, in the Jobs view, group by Status, and find the running or canceling job for the object. When the job is complete, try again.
    I have already tried running the following command in SQL Server Management Studio
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    I received this error back:
    Msg 8169, Level 16, State 2, Line 1
    Conversion failed when converting from a character string to uniqueidentifier.
    I have also tried rebooting both the host and the Virtual Machine Manager Server.  After rebooting them both, I still receive the same error when trying to remove the host.
    Here are my server details
    VMM Server OS = Windows 2012 Standard
    VMM Version = 2012 R2 3.2.7510.0
    Host OS = Windows 2012 R2 Datacenter
    Host Agent Version = 3.2.75.10.0
    SQL Server OS = Windows 2012 Datacenter
    SQL Version = 2012 SP 1 (11.0.3000.0)

    Hi there,
    How many hosts are you managing with your VMM server?
    The locking job might be the background host refresher job. Did you see any jobs in the jobs view, when the host removal job failed?
    If there is no active jobs in the jobs view when this host removal job fails, can you please turn on the VMM tracing, retry the host removal, and paste back the traces for the failed job (search for exception and paste the whole stack)?
    Thanks!
    Cheng

  • How to remove characters/lines from the beginning of an InputStream

    Hi,
    I have a program which receives several InputStreams. From each of these streams I have to remove 2 lines from the beginning. After the lines are removed, all the streams are combined to one with SequenceInputStream and read in one chunk. Is there an easy/simple way of doing this?
    One option I thought would be to read the char by char until 2 end of line chars have been detected and then read the rest of the data to a buffer. And the create a ByteArrayInputStream out of this buffer. Problem with this approach is, that the amount of data can be large, so putting all the data in to memory might cause problems.
    Another option is to use BufferredInputStream and use the readline() method twice to get rid of the lines that are not needed. After this I would write the data to some output stream, which is then converted back to input stream. Propably would work, but sound too much of work for a simple thing like this. There has to be better way.
    To make it simple, what I need is a method that looks like the following, or something similar
    *  Removes n number of lines from the beginning of a InputStream.
    *  @param is InputStream where the lines are removed
    *  @param numberOfLines int value to indicate how many lines whould be removed
    *  @return InputStream where lines have been removed.
    public InputStream removeLines(InputStream is, numberOfLines);Thanks.

    Here's the code, feel free to use it. Comments are also welcome.
    public InputStream removeLinesFromTheBeginning(InputStream is, int numberOfLines) throws IOException
              char c = 'c';
              int i = 0;
              for(int n = 0 ; n < numberOfLines ; n++)
                   do
                        c = (char)is.read();
                        System.out.print(c);
                        if(c == (char)-1)     // end of stream reached before any newline characters were found.
                             return null;
                        i++;
                   while(c != '\n');
                   System.out.println();
                   System.out.println("Characters removed:" + i);
                   System.out.println("n: " + n);
                   i = 0;
              return is;
         }Edited by: dave_spaghetti on Jun 16, 2009 5:42 AM
    Fixed a bug.

  • Unable to get command line from client!

    Does anyone know what this means? My G5 shuts itself down and I don't know what is causing it.
    Mac OS X Version 10.4.11 (Build 8S165)
    2009-02-12 11:01:19 -0800
    2009-02-12 11:01:21.760 SystemUIServer[199] lang is:en
    Feb 12 11:01:33 mDNSResponder: NAT Port Mapping (LLQ event port.): timeout
    Feb 12 11:01:37 cups-lpd[221]: Unable to get command line from client!
    Feb 12 11:10:48 Zelle-Olson cups-lpd[233]: Unable to get command line from client!
    Feb 12 11:17:37 cups-lpd[235]: Unable to get command line from client!

    Hello golferky,
    CUPS stands for Common Unix Printing System and is just one of the many background processes that is running on your system and is of no harm. What you are seeing in your message console is your Mac attempting to talk to a printer you have may have had or still have it connected to.
    Here is more information if you want to look into it.
    http://www.cups.org/
    B-rock

  • Is there a charge to remove a line from my plan?

    I have several lines on my current wireless plan.  Will there be a charge to remove any of those lines and if so, how much is the fee?

        KWildman, the more, the merrier! Why would you want to remove a line from your account? Let's talk about this.
    When accepting a two year agreement, each line has it's own contract end date. If you cancel services prior to the contract end date, then you will be billed an Early Termination Fee. This fee varies based on the device that you upgraded to and amount of months that you've completed on that contract. For more information regarding your customer agreement and how the Early Termination Fee is calculated, click http://bit.ly/17srsZb
    Lasina_VZW
    VZW Support
    Follow us on Twitter @VZWSupport

  • Apple TV unable to remove tv shows from favorites

    After the latest upgrade I am unable to remove tv shows from favorites and when I rearrange the icons they go back to the previous order after a few minutes.  Is anyone having this issue?  Any ideas on a resolution or is this just another of the many bugs in the latest release?

    Hi arnie9,
    If you are having unusual interface behavior with your Apple TV after a recent update, you may find the following article helpful:
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    http://support.apple.com/kb/ht4367
    Regards,
    - Brenden

  • How to remove new line from string

    I have a string say following
    String line = "one\ntwo\nthree";Now i am trying to remove new line from string. For this i did following
    String txt = line.replaceAll("\\n","");But i see still new line is occuring. Is it correct way. Please advice me.

    Ok. I was just using \n instead of \r\n. And i am in windows. I will give a try with \r\n
    Ok i tried using following , but it doesnt work.
    line = line.replaceAll("\\r\n","");Am i missing anything here. Please guide me.
    Edited by: ArpanaK on Oct 8, 2007 4:44 PM

  • How can i remove a line from an ordinary text file?

    It is easy to remove a line from a file by rewriting the file. how can i remove a line without rewriting ? Also, do not use whitespaces to overwrite the line. I expect a perfect line deletion code .....

    gimbal2 wrote:
    hsc71 wrote:
    It's the way you communicate. Try to be carefull with the words you use in your post. It's easy to insult people just by choosing the wrong words. Bold text and capitals is equal to shouting.
    shock. You said "wrong words". I am seriously offended by that!
    Seriously, would you care that I am offended? I really hope not... Say what you want, people will find reasons to take offense one way or the other.Hehe, maybe you're right, but the OP still has no answer.............and in the end that's what he/she is looking for.

  • //remove this line if you want to edit the code by hand? um which line?

    Several of my pages are locking up and I don't know why. As I work through the code, I remembered that I altered some text in a SendEmail by directly altering the page rather than using the Server Behavior. Don't understand why that would matter but whatever...
    Now as I ponder if that is causing the problem, I ran across this commented line in the code:
    //remove this line if you want to edit the code by hand
    But are they talking about the line just after that line of //remove or do they mean the actual comment line of
    //remove this line if you want to edit the code by hand?
    Thanks for your help

    Trigger and $tNG look suspiciously like ADDT code to me. Ask the guys in the ADDT forum (http://forums.adobe.com/community/dreamweaver/addt). There are a couple of them in there who know the code intimately. I haven't touched ADDT for ages.

  • Hey i bought this second hand Ipod 5th generation from the owner but she forgot her password on apple ID and how do i remove this device from their account... Any suggestions

    how to remove this device from their account i bought it second hand and they for got there apple ID and password 5th generation IPOD touch

    You are running intoi the Activation Lock
    iCloud: Find My iPhone Activation Lock in iOS 7
    The previous owner has to recover the ID and password for the account last used on the iPod
    Is there a way to find my Apple ID Name if I can't remember it?
    Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.
    An then she has to remove the iPod from her account
    Find My iPhone Activation Lock: Removing a device from a previous owner’s account
    If you can't do then return the iPod for a refund. Otherwise y have a thin brick, maybe a stolen/lost  one

  • I am unable to get dragging guides from rulers when using CS6 InDesign. Is anybody else getting this problem?

    I am unable to get dragging guides from rulers when using CS6 InDesign. Is anybody else getting this problem?

    Try restoring your InDesign preferences:
    Trash, Replace, Reset, or Restore the application Preferences

  • [svn] 4694: Don't remove text lines from the container if it isn' t the container the lines were added to.

    Revision: 4694
    Author: [email protected]
    Date: 2009-01-27 14:35:21 -0800 (Tue, 27 Jan 2009)
    Log Message:
    Don't remove text lines from the container if it isn't the container the lines were added to. When there is a state change the displayObject can be switched out from under the TextGraphic and TextBox.
    QE Notes: need to add tests - will attach my test program to bug
    Doc Notes:
    Bugs: SDK-18923
    Reviewers: Gordon
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-18923
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/TextBlockCompose r.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/TextFlowComposer .as

    Yup, you guys pointed me in the right direction.
    I changed my adjustmentListener to the following:
    JScrollBar scrollBar = (JScrollBar) e.getSource();
    int endLoc = document.getLength();
    try {
        Rectangle end = outputArea.modelToView(endLoc);
        if (end != null) {
            int n = scrollBar.getValue() + scrollBar.getVisibleAmount();
            boolean locked = (end.y >= n && n <= (end.y + end.height));
    } catch (BadLocationException ex) {
    }By comparing scrollbar position with the visible rectangle of the end of the document, I can now easily tell if the user has moved the tracker back or not.
    To go to the next step of automatically pausing scrolling whenever the user is moving the slider back, I also had to disable the automatic scrolling performed by DefaultCaret. Because there was no way to tell if the user was scrolling or if the output was adjusting from the adjustmentListener, I also had to flag whenever I was autoscrolling.
    The end result is a JTextPane that can be appended to at all, and locked by the user by using the slider. If new data arrives, the window is not scrolled, and any text selection the user has is not cleared. Perfect!

  • How do i remove a line from my family plan?

    I need to remove a line from my family plan, how do i do it on the computer?

    You can't cancel service on-line; you'll need to either call Customer Service or visit your local Corporate Verizon store.

Maybe you are looking for

  • Not able to view Characteristic Hierarchy using Tcode KES3

    Hi everyone, I need to view the Characteristic Hierarchy using T-code KES3 in CO-PA. Ideally, once we are into KES3 screen, we need to select the characteristic and variant to display the hierarchy. But, when I select the characteristic and variant,

  • Connection - ADSL

    My line settings are as follows is this good or bad & should I do something about it? Line state: Connected Connection time: 1 days, 01:31:52 Downstream: 1,536 Kbps Upstream: 448 Kbps VPI/VCI: 0/38 Type: PPPoA Modulation: G.992.1 Annex A Latency type

  • Outgoing mail does not send embedded images

    When I send an embedded image the recipient only receives the text. The Image is stripped from the email. There are NO blank boxes with an x in it.

  • Credentials to use adobe interactive form

    Hi    I see an OSS note that talks about creating a OSS ticket to SAP requesting them for credentials to use an adobe interactive form. We are on ECC 5.0 ( WAS 640 ) and intend to generate an adobe interactive form using a combination of adobe livecy

  • How to xfer itunes library to new computer?

    i have 10GB of music on my old laptop (windowsXP) with many playlists, very little purchased from itunes - mostly my own CDs i ripped. well, i bought a new computer (windowsVista) and want to transfer my itunes with playlists from my old computer to