Problems with PowerShell script

Hi guys.
Using this powershell scripts:
http://gallery.technet.microsoft.com/office/Lync-Environment-Report-cbc6fb1a
I have already a opened thread on MS TECHNET FORUM:
http://social.technet.microsoft.com/Forums/office/en-US/a23ffdf8-fb10-4386-b21b-9f06cda84bdd/lync-environment-report-draw-pictures-in-visio?forum=lyncdeploy
unable to solve the error for powershell script: New-LyncEnvDiagram.
Is there any of you Power$hell Mai$ter$ able to understand why the script ain't working?
with best regards,
bostjanc

Hi Bostjanc,
Since we have no test enviroment, and this is difficult for us to debug the script.
Maybe you can try to leave a comment to ask the author chris for helps:
http://emptymessage.com/?p=149
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support

Similar Messages

  • Problem with powershell script

    Hello All
     I have the following Script that doesnt run, note that Im new at Ps and it is modified from another one seen in other post
    $Parameters = Import-Csv C:\Parameters.csv
    ForEach($Parameter in $Parameters)
    { $Server = ($Parameter.Server)
     $Port = ($Parameter.Port)
        If ( Test-Connection $Server -Count 1 -Quiet) {
            try {
                $null = New-Object System.Net.Sockets.TCPClient -ArgumentList $Server,$Port
                $props = @{
                    Server = $server
                    PortOpen = 'Yes'
            catch {
                $props = @{
                    Server = $Server
                    PortOpen = 'No'
        Else {
            $props = @{
                Server = $server
                PortOpen = 'Server did not respond to ping'
        New-Object PsObject -Property $props
    However when I try to run it in the Powershell ISE I get the following error.
    PS C:\Windows\system32> C:\PorVerification\PortVerification.Ps1
    Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
    At C:\PorVerification\PortVerification.Ps1:9 char:25
    +     If ( Test-Connection <<<<  $Server -Count 1 -Quiet) {
        + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand
    New-Object : Cannot validate argument on parameter 'Property'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
    At C:\PorVerification\PortVerification.Ps1:35 char:34
    +     New-Object PsObject -Property <<<<  $props
        + CategoryInfo          : InvalidData: (:) [New-Object], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.NewObjectCommand
    Any Clue on what could it be? Im running this in Windows 7. Any help will be highly apretiated.

    This is because you're not getting any data for the $Server variable.
    This may be due to bad data in the CSV file, or misspelled header name (first row)
    You can add an if statement like:
    $Parameters = Import-Csv C:\Parameters.csv
    ForEach($Parameter in $Parameters)
    { $Server = ($Parameter.Server)
    $Port = ($Parameter.Port)
    if ($Server)
    If ( Test-Connection $Server -Count 1 -Quiet) {
    try {
    $null = New-Object System.Net.Sockets.TCPClient -ArgumentList $Server,$Port
    $props = @{
    Server = $server
    PortOpen = 'Yes'
    catch {
    $props = @{
    Server = $Server
    PortOpen = 'No'
    Else {
    $props = @{
    Server = $server
    PortOpen = 'Server did not respond to ping'
    New-Object PsObject -Property $props
    else {
    "No data received for '$Server'"
    So, the "if ($server)" line and its corresponding "else" will point out when you're not getting a value for $server.
    I would also add some error checking for the presence of the CSV file..
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
    Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx

  • Little execution problem with the script

    declare
    i number(1):=1;
    name varchar2(10);
    id number(2);
    begin
    loop
    id:=&id;
    name:='&name';
    insert into emp values(id,name);
    i:=i+1;
    exit when id<=5;
    end loop;
    end;
    When i tried to execute the script, it is going through the loop only once..What the problem with this script...Can any body help the script work?

    if id is less or equal to 5 then loop will execute only once.
    What is the variable i for ?

  • Problem with a script to remove graphics

    Hello,
    I have tried to build a javascript to remove all graphics whose extension is not ".EPS" (with "EPS" really in upper cases, as it is for Mathtype equations in Word import).
    But It doesn't work and I can't understand why.
    Here is the script:
    //The script intend to remove all graphics whose extension is not ".EPS"
    var myDoc = app.activeDocument;
    var myGraphics = myDoc.allGraphics
    //Remove graphic if graphic extension is different from ".EPS"
    for (var p = 0; p < myGraphics.length; p++) {
        var myImage = myGraphics[p]
        if (CheckExtEps(myImage) != 0){
        myImage.remove ()
    //Compare graphic extension with ".EPS" and return myExtValue = 0 if it matches exactly
    function CheckExtEps(myImage) {
        var  myString = myImage.name
        myExt = myString.substr(myString.lastIndexOf( "." ))
        myExtValue = myExt.localeCompare(".EPS")
        return myExtValue
    When I run this script, ALL the graphics are removed, ".EPS" included.
    I do have ".EPS" graphics in my document and I expected them not to be removed.
    So there is something wrong somewhere, but I don't know what to change.
    Any ideas?
    By the way, I have a more generic question as a beginner:
    I am working with ExtendScript Toolkit. How can I do to check my script step by step?
    For exemple, how can I display my variables values as "myString", "myExt", "myExtValue" at each step?
    Actually, this script is a step for a bigger script I intend to build to deal with Mathtype equations in Word import.
    After not-EPS graphics beeing removed, I wish to relink all remaining equation prewiews to eps in a selected folder, by consecutive order.
    But this is a big piece of scripting to swallow for me, so I'm working slowly, step by step.
    TIA
    Best regards
    Nicolas

    Hello Ariel
    Thank you very much for your help.
    1. I added semicolons at the end of lines, but the script result is the same.
    2. Running line by line, I could see in the Console where is the problem:
    variable "myString" is always undefined.
    Well, I have to get more inside my script...
    Thank's again
    Best regards
    Nicolas
    Nicolas BALBO  
    [email protected]
    22, rue d'Hauteville  75010 PARIS
    Tel : 33 (0)1 42 57 14 31
    Le 18 avr. 2012 à 17:36, Arïel a écrit :
    Re: Problem with a script to remove graphics
    created by Arïel in InDesign Scripting - View the full discussion
    Well, I can't see any semicolons in your script. Maybe that's just the
    email interface, but there should be semicolons at the ends of lines.
    In the ESTK, you can step through a script a line at a time. Just click
    on the downwards pointing arrow instead of the "play" arrow. Each time
    you click, the script will advance one line. In the Console window
    (Windw>Console) you can then type the name of the variable you wish to
    examine.
    Ariel
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4344039#4344039
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4344039#4344039. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in InDesign Scripting by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Problem with navigation script

    Hi I'm having trouble getting a button work correctly when
    pressed it should take user to a particular label on the main
    scene. Is there a problem with my script? The button is inside a
    movie clip which is inside another movie clip. Thanks in
    advance.

    this quite difficult to explain but here goes. i have a
    complex button with a roll in roll out effect. ie. a movie clip
    acting as a button that shows different buttons (in another movie
    clip) when it is rolled over. I then want the different buttons to
    go to other parts in the main timeline. the code works fine when
    the buttons are on the main timeline but because it is within
    another two movie clips it doesnt work like it should. In fact the
    script i have used in the first movie clip also affects the button.
    This script is as follows and belongs in the first frame of the
    first movie clip. In other words, I need the button not to be
    effected by the following script but by the gotoAndPlay script.
    Thanks

  • Problem with SAP Script FAX output

    Hi Friends,
    I have problem with SAP Script Fax output.
    After I issued output using the messge type, the print preview format shows me correct alignments and the right data. But when I go to List display using the menu bar functions from the print preview screen, the list is showing me the right data, but all the alignments at the main window went wrong.
    How do I rectify this problem? I need correct alignments in both form display and list display.

    Hi Sasidhar,
    Have you tried with different fax machine.
    Regards,
    Atish

  • BCS Set Permissions problem with PowerShell

    Hello, I am seeing an odd behavior, was wondering if anyone else encountered this problem before.
    I have a large BDC Model with multiple Entities (ECTs) that was created with Visual Studio, as part of the process we have a Powershell script that iteritates all the entities and sets their permissions to the 'All Authenticated Users' group. 
    $serviceContextURL="https://ACME.dsi-sp.com/"
    $ECTNamespace="ACMEBusinessDataConnectivityModel.ACMEReportingPortal"
    [String[]]$permissions=@("Execute","Edit","SelectableInClients","SetPermissions")
    $bdc = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType Catalog -ServiceContext $serviceContextURL
    # Get the list of all LOB systems
    $lobs = $bdc.GetLobSystems("ACMEReportingPortal")
    Foreach($lob in $lobs){
        $lobEntities = $lob.Entities
        Write-Host $lob.DefaultDisplayName
        foreach($entity in $lob.Entities) {
            write-host "ECTName: " $entity.Name
            $ECTName = $entity.Name
            $ECT = Get-SPBusinessDataCatalogMetadataObject -BdcObjectType "Entity" -ServiceContext $serviceContextURL -Name $ECTName -Namespace  $ECTNamespace
            if($ECT-ne $null)
                 $user = New-SPClaimsPrincipal -EncodedClaim "c:0(.s|true"
                 Grant-SPBusinessDataCatalogMetadataObject -Identity $ECT -Principal $user -Right $permissions
                 write-host "Permissions set for " $ECTName
            else
                 write-host -f Yellow $ECTName external content type does not exists
    The script works fine as expected, however when you try to access the External List that is based on one of these ECTs, you get access denied. I then go into BCS validate the permissions are set as expected i.e. 'All Authenticated Users' is selected with
    the four permission, and it looks fine. try again access denied. I then go and remove the 'All Authenticated Users' group from Permissions, and manually re-add it back, try the External list again, now it works. !
    Has one seen this before or can comment on why it is not working with powershell?  is there a service recycling needed perhaps or something like that?
    Thanks in advance, mark
    Mark A. Eckert SharePoint Consultant Pharmica Consulting, Inc.

    Thanks for responding. 
    its too repetitive to keep adding permissions via CA, there are a lot of entities and we are in a constant state of developing the BDC solution so we are deploying it a lot.
    In ULS, it looks like impersonation is breaking down with ReadList and NT AUTHORITY\IUSR
    02/05/2013 13:45:55.52  w3wp.exe (0x0E7C)                        0x0834 Business Connectivity Services Business Data                
     g0jq High     Access Denied for User '0#.w|dsi-sp\meckert', which may be an impersonation by 'NT AUTHORITY\IUSR'. Securable MethodInstance with Name 'ReadList' has ACL that contains:   8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53  w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Monitoring                     b4ly High     Leaving Monitored Scope (EnsureListItemsData). Execution Time=636.737909427036 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53  w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a1 High     Error while executing web part: Microsoft.SharePoint.SPException: Access denied
    by Business Data Connectivity. ---> Access Denied for User '0#.w|dsi-sp\meckert', which may be an impersonation by 'NT AUTHORITY\IUSR'. Securable MethodInstance with Name 'ReadList' denied access. Stack Trace:    at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternal(IDataClass
    thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteInternal(IDataClass
    thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMeth... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a1 High     ...od methodToExecute, IParameterCollection nonReturnParameters, Object[]&
    overrideArgs, IFilterCollection filters)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteFiltered(IEntity this, IFilterCollection filterCollection, IMethodInstance methodInstanceToExecute, ILobSystemInstance lobSystemInstance)    
    at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.<FindFiltered>b__3(IEntity e, IMethodInstance mi, IFilterCollection fc, ILobSystemInstance lsi)     at Microsoft.SharePoint.BusinessData.Runtime.EntityInstanceEnumeratorFactory.CreateEntityInstanceEnumerator(IEntity
    entity, IMethodInstance methodInstance, IFilterCollection filters, ILobSystemInstance lobSystemInstance, ExecutionCallBack executionCallBack)     at Microsoft.SharePoint.BusinessData.MetadataModel.Sta... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a1 High     ...tic.Entity.FindFiltered(IFilterCollection filterCollection, String finderName,
    ILobSystemInstance lobSystemInstance)     at Microsoft.SharePoint.SPListDataSource.GetEntityInstanceEnumerator(XmlNode xnMethodAndFilters)      --- End of inner exception stack trace ---    
    at Microsoft.SharePoint.SPListDataSource.GetEntityInstanceEnumerator(XmlNode xnMethodAndFilters)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstancesInternal(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal,
    String firstRowId, Boolean fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstances(XmlDocument
    xdQue... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a1 High     ...ryView, Boolean fFormatDates, Boolean fUTCToLocal, String firstRowId, Boolean
    fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListItemCollection.EnsureEntityDataViewAndOrdering(String&
    bdcidFirstRow, String& bdcidNextPageFirstRow)     at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()     at Microsoft.SharePoint.SPListItemCollection.get_Count()     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments
    selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)     at Microsoft.ShareP... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a1 High     ...oint.WebControls.SingleDataSource.GetXPathNavigatorInternal()    
    at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53  w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a2 High     InnerException 1: Access Denied for User '0#.w|dsi-sp\meckert', which may be
    an impersonation by 'NT AUTHORITY\IUSR'. Securable MethodInstance with Name 'ReadList' denied access. Stack Trace:    at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance
    lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteInternal(IDataClass
    thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs, IFilterColle... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a2 High     ...ction filters)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteFiltered(IEntity
    this, IFilterCollection filterCollection, IMethodInstance methodInstanceToExecute, ILobSystemInstance lobSystemInstance)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.<FindFiltered>b__3(IEntity e, IMethodInstance
    mi, IFilterCollection fc, ILobSystemInstance lsi)     at Microsoft.SharePoint.BusinessData.Runtime.EntityInstanceEnumeratorFactory.CreateEntityInstanceEnumerator(IEntity entity, IMethodInstance methodInstance, IFilterCollection filters,
    ILobSystemInstance lobSystemInstance, ExecutionCallBack executionCallBack)     at Microsoft.SharePoint.BusinessData.MetadataModel.Static.Entity.FindFiltered(IFilterCollection filterCollection, String finderName, ILobSystemInstance ... 8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53* w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Web Parts                      89a2 High     ...lobSystemInstance)     at Microsoft.SharePoint.SPListDataSource.GetEntityInstanceEnumerator(XmlNode
    xnMethodAndFilters)  8b44f992-350b-4560-bf52-e0308d4b6382
    02/05/2013 13:45:55.53  w3wp.exe (0x0E7C)                        0x0834 SharePoint Foundation        
     Monitoring                     b4ly High     Leaving Monitored Scope (DataBinding DataFormWebPart (Submission Milestone)). Execution
    Time=684.852125060587 8b44f992-350b-4560-bf52-e0308d4b6382
    Mark A. Eckert SharePoint Consultant Pharmica Consulting, Inc.

  • Problems signing Powershell Scripts

    Hi world,
    I'm trying to sign a powershell script with a self issued code signing certificate. I created the certificate using following command lines:
    "makecert.exe" -n "CN=Code Signing Certificate Root" -a sha1 -eku 1.3.6.1.5.5.7.3.3 -r -sv "%Temp%\MakeMyCert\MyCERT.pvk" "%Temp%\MakeMyCert\MyCERT.cer" -ss Root -sr localMachine
    "makecert.exe" -pe -n "CN=My Certificate" -ss MY -a sha1 -eku 1.3.6.1.5.5.7.3.3 -iv "%Temp%\MakeMyCert\MyCERT.pvk" -ic "%Temp%\MakeMyCert\MyCERT.cer"
    "pvk2pfx.exe" -pvk "%Temp%\MakeMyCert\MyCERT.pvk" -pi "%Password%" -spc "%Temp%\MakeMyCert\MyCERT.cer" -pfx "%Temp%\MakeMyCert\MyCERT.pfx" -po "%Password%"
    After that I try to sign my script using the MyCert.pfx file. I made sure, that the PS1 powershell script file is saved in UTF-8. I use following powershell commands (I'm asked for a Password after Get-PfxCertificate):
    $cert=Get-PfxCertificate .\MyCert.pfx
    Set-AuthenticodeSignature .\MyScript.ps1 -Certificate $cert
    The result I get is "UnknownError", though the signature block gets written into the MyScript.ps1 file. If I read the Authenticode signature using
    Get-AuthenticodeSignature .\MyScript.ps1
    it still gives me the Signer Certificate followed by "UnknownError". I really don't know where to search. As mentioned before, it is not the Encoding issue. I already played around saving the PS1 file in ASCII, UTF-8, UTF-8 w/o BOM. It doesn't
    make any difference.

    I think I found the problem. Do not use pvk2pfx.exe to create your pxf file. This works in Win 7 but no longer in Win 8.1 or 2012 R2. You manually need to export the certificate including the key using certmgr.msc and save it as PFX file. Then you can use
    this file with the Get-PfxCertificate commandlet.
    This way it also works in Win 8.1 and Server 2012 R2.

  • Split filename and create folders with Powershell script ( --newbie user)

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!

    I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
    C:\workpics\1238955678.1
    C:\workpics\744556224.1
    C:\workpics\744556224.2
    C:\workpics\8445655996.1
    I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
    C:\workpics\12389\55678.1
    C:\workpics\7445\56224.1
    C:\workpics\7445\56224.2
    C:\workpics\84456\55996.1
    Any assistance to create this Powershell script would be awesome. Thank you!!
    Please reread your request.  It makes no sense.  Read each statement carefully and notice that the statements are in conflict.
    Start your scrip in PowerShell.  Look up things like how to list files and how to manage strings.  All of the information you need is here:
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    ¯\_(ツ)_/¯

  • Problem with sap script table in main window

    hi all,
    i have created a sap script  for which output is in 7 pages.
    except first page all the remaining pages are giving the correct output.
    the problem with the first page is iam not not getting vertical lines in the table which is in the main window of page 1.
    iam getting the vertical lines correctly in the mainwindow table of all the remaining pages.

    Hi,
    It's simple,
    Pre- U should had declared a second page for the same window with header, main & footer.
    now
    First when u r looping the internal table provide no of rows eg Row 1 TO 10. in the Loop ( Data Tab)
    or
    when defing TEXT Go to PC Editor and mention all the fields Under  PROTECT -  ENDPROTECT.
    This would solve the issue.
    Thanks
    Ravi

  • Update a filed value with powershell script with ordery by and where condition

    Hi
    I have below powershell script to update list columns but  how i update a field value with ordery by a column and where condition
    below is the part of my script
    $list = $web.Lists[$listName]
    $items = $list.items
    $internal_counter = 1
    #Go through all items
    foreach($item in $items)
    if($item["CourtNO"] -eq $null)
    #if($item["CourtNo"] -eq '1')
    $item["CaseNo"] = $internal_counter
    #how to add a column ordery by Title
    # and where Title field value from 1 to 10
    $internal_counter++
    adil

    Hi,
    You mean that you only need to update all items with Title field value in range 1..10 and order by them before run the loop statement update?
    If so, use CAML query to get the items only match the condition.
    #Build Query
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $query = '<Where><And><Gte><FieldRef Name="Title" /><Value Type="Text">0</Value></Gte><Lte><FieldRef Name="Title" /><Value Type="Text">10</Value></Lte></And></Where><OrderBy><FieldRef
    Name="Title"/></OrderBy>'
    $spQuery.Query = $query
    $spQuery.RowLimit = $list.ItemCount
    $items = $list.GetItems($spQuery)
    Hope this help!
    /Hai
    Visit my blog: My Blog | Visit my forum:
    SharePoint Community for Vietnamese |
    Bamboo Solution Corporation

  • Problems with Java Scripting API

    Hello Everyone!
    Guys, I need help with Java scripting API. A problem is that I cannot understand how can I operate Java Object's fields and methods from the script language. I have chosen embedded javascript to work with. And I can get the fields and methods of in-box java classes (such as ArrayList for example), but I cannot work with methods and fields from my own classes!
    Here is an example:
    public class ScriptingExample {  
        class MyClass {  
            int myfield = 5;  
            int getInt() {return 7;}  
        public void runExample() {  
            ScriptEngineManager mgr = new ScriptEngineManager();  
            List<ScriptEngineFactory> factories = mgr.getEngineFactories();  
            ScriptEngineManager factory = new ScriptEngineManager();  
            ScriptEngine engine = factory.getEngineByName("JavaScript");  
            MyClass mc = new MyClass();  
            try{  
                engine.put("mc", mc);  
                engine.eval("print(mc.myfield); print(mc.getInt())"); // or engine.eval("print(mc.myfield)");
            } catch (Exception e) {e.printStackTrace();}  
    }  If I run the code with the commented part it prints "undefined" instead of "5".
    If I run the code as it is it prints error instead of "7":
    undefinedjavax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getInt. (<Unknown source>#1) in <Unknown source> at line number 1
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at solutiondatabase.ScriptingExample.runExample(ScriptingExample.java:26)
    at solutiondatabase.Main.main(Main.java:49)
    How can I fix it?

    Guys,
    please let me raise this topic because several new questions emerged.
    (1) How can I get all the variables created inside my engine?
    There are two kinds of variables: first kind is Java obejcts put inside the engine and second kind is the variables created in my script, such as 'var a = 4;'. How can I list all the variables of that two kinds?
    (2) Is there is a way to make 'import static' to the engine? I dont want to write MyClass.MyEnum.MyEnumItem every time. Also, I cannot put the whole enum into the engine with engine.put("MyEnum", MyEnum); I can put only enum items separately: engine.put("MyEnum", MyEnum.EnumItemA);. Thats why I ask about static import.
    (3) How can I cast engine variables back to java variables inside my java code?
    Here is my example:
    package mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineFactory;
    import javax.script.ScriptEngineManager;
    public class Main
         public static void main(String[] args) throws Exception 
              ScriptEngineManager mgr = new ScriptEngineManager();
              List<ScriptEngineFactory> factories = mgr.getEngineFactories();
              ScriptEngineManager factory = new ScriptEngineManager();
              ScriptEngine engine = factory.getEngineByName("JavaScript");
              ArrayList<Double> myList = new ArrayList<Double>();
              myList.add(5.0);                    
              engine.put("MyList", myList);     
              engine.eval("MyVar = MyList.get(0);");
              System.out.println((Double)engine.get("MyVar"));
    }The result is:
    Exception in thread "main" java.lang.ClassCastException: sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.Double
    +     at mypackage.Main.main(Main.java:28)+
    Is it possible to retrieve my Double java object from the engine?
    Edited by: Dmitry_MSK on Aug 6, 2010 1:56 AM

  • Problem with sap script

    Hi All,
    I have a problem with a sap script (PO) everytime when an item is deleted (on me23e) it doesn't display on the on the print preview and the client wants to see on the preview with a sign indicating the deleted item.
    SELECT ebeln ebelp pstyp packno txz01 loekz
      FROM ekpo
      INTO TABLE it_ekpo
      WHERE ebeln = po_no
      AND  loekz NE 'L'
      AND  loekz NE 'S'.
    This is how it has been read from the ekpo.... Is there something that I need to change? 
    Thanks in advance.
    Regards,
    Fred.

    Hi,
    In EKPO table the field 'loekz'  indicates the Deletion status.
    So u can consider the deleted line item also.
    u change u r query like this.
    SELECT ebeln ebelp pstyp packno txz01 loekz
    FROM ekpo
    INTO TABLE it_ekpo
    WHERE ebeln = po_no.
    In it_ekpo table u can get all the line item(including deleted items).
    Then u cn print the data.
    Hope this will helps u.

  • Problem with ksh script

    Hi
    This is for scripting gurus,
    I am on "SunOs"
    I have created below ksh script to fetch table space info; problem is that I can not have any out put in my variable (TS_DATA);; I don't want to use utl file in my pl/sql can any one tell what went wrong with my script. Thanks in advance
    temp() {
    GET_DB_PASS
    TS_DATA=`sqlplus -s /nolog <<EOSQL
    whenever sqlerror exit failure
    set serveroutput on
    set feedback off
    set pause off
    set echo off
    set heading off
    set verify off
    connect ${l_connect_string}
    DECLARE
    TYPE t_task_tab IS TABLE OF VARCHAR2 (1000)
    INDEX BY BINARY_INTEGER;
    t_tab_space_name t_task_tab;
    t_tot_byte t_task_tab;
    t_fr_byte t_task_tab;
    t_max_chunk t_task_tab;
    t_rpt_txt t_task_tab;
    t_rpt_num t_task_tab;
    l_count number :=0;
    BEGIN
    SELECT tablespace_name,NVL(SUM(bytes),1),1,1
    BULK COLLECT INTO t_tab_space_name,t_tot_byte,t_fr_byte,t_max_chunk
    FROM dba_data_files
    GROUP BY tablespace_name;
    FOR i IN t_tab_space_name.FIRST..t_tab_space_name.LAST
    LOOP
    SELECT NVL(SUM(b.bytes), 1) INTO t_fr_byte(i)
    FROM dba_free_space b
    WHERE t_tab_space_name(i) = b.tablespace_name;
    IF (95 < 100-(t_fr_byte(i)*100/t_tot_byte(i))) THEN
    l_count := l_count + 1;
    SELECT t_tab_space_name(i),TO_CHAR(ROUND(100-(t_fr_byte(i)*100/t_tot_byte(i)), 2))
    INTO t_rpt_txt(i),t_rpt_num(i) FROM dual
    WHERE 95 < 100-(t_fr_byte(i)*100/t_tot_byte(i));
    dbms_output.put_line(t_rpt_txt(i));
    dbms_output.put_line(l_count);
    END IF;
    END LOOP;
    END;
    EOSQL`
    echo $TS_DATA
    temp

    if this is SunOS specifice, is the wrong mailing list..
    what about someting simple:
    cat y.sh#!/usr/bin/ksh
    temp() {
    TS_DATA=`sqlplus -s /nolog <<EOSQL
    connect scott/tiger
    select count(*) from emp;
    exit
    EOSQL`
    echo "${TS_DATA}"
    temp
    ./y.shConnected.
    COUNT(*)
    15
    >
    so works fine on Linux......
    not sure what you are up to, but
    #!/usr/bin/ksh
    temp() {
    sqlplus -s /nolog <<EOSQL
    connect scott/tiger
    select count(*) from emp;
    exit
    EOSQL
    temp
    also should write the output to the stdout; not really sure why you need to use variables to store the results
    guido

  • Problem with TCl script

                       Hello I need help, my Cisco Router (2921) work not correct with tcl script.
    Tcl script work fine on this device long time, but in one time script was not start get error(no any script changes):
    005495: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: Unknown error 2620
    005496: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     while executing
    005497: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: "close $myfileid"
    005498: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     invoked from within
    005499: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: "$slave eval $Contents"
    005500: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     (procedure "eval_script" line 7)
    005501: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     invoked from within
    005502: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: "eval_script slave $scriptname"
    005503: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     invoked from within
    005504: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: "if {$security_level == 1} {       #untrusted script
    005505: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:      interp create -safe slave
    005506: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:      interp share {} stdin slave
    005507: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:      interp share {} stdout slave
    005508: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: ..."
    005509: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl:     (file "tmpsys:/lib/tcl/base.tcl" line 50)
    005510: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: Tcl policy execute failed:
    005511: Aug 26 08:46:27: %HA_EM-6-LOG: event.tcl: Unknown error 2620
    If I try do command it not help:
    no event manager policy event.tcl
    event manager policy event.tcl
    I try reload script in router, and every time then script was start, some part of script file was deleted (it very intrusting, because i think script in flash only read (not write))
    Only reload help, auto reload script work fine.
    Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M6, RELEASE SOFTWARE (fc2)

    hello Joseph, this TCL script work long time with out any problem and with out any changes.
    On this device I change configuration (add two EEM aplet with event tag syslog pattern) auto this modification i have problem. May be I try do all my configuration on TCL script.
    I add EMM (it work with out any problem): 
    event manager applet RESET-3G-S
    event tag 1.0 syslog pattern "%TRACKING-5-STATE: 2 ip sla 2 reachability Up->Down"
    event manager applet 3G-EEM-STOP
    event tag 1.0 syslog pattern "%TRACKING-5-STATE: 2 ip sla 2 reachability Down->Up"
    My scipt have syslog patern:
    ::cisco::eem::event_register_syslog tag 1 pattern ".*SEC_LOGIN-4-LOGIN_FAILED: Login failed.*" occurs 1 maxrun 50
    ::cisco::eem::event_register_syslog tag 2 pattern ".*%SEC_LOGIN-5-LOGIN_SUCCESS: Login Success*" occurs 1
    ::cisco::eem::event_register_syslog tag 3 pattern ".*%SYS-5-RESTART.*" occurs 1
    ::cisco::eem::trigger {
    ::cisco::eem::correlate event 1 or event 2 or event 3
    ::cisco::eem::attribute tag 1 occurs 1
    ::cisco::eem::attribute tag 2 occurs 1
    ::cisco::eem::attribute tag 3 occurs 1
    Tahnk you

Maybe you are looking for

  • Diffrence between backend insert and front end insert into a table.

    I am developing a conversion program for tax exemption. For this program only ZX_EXEMPTIONS table is used to populate the data and we got confirmation from Oracle also regarding this.For inserting the data into this table we are taking the max of tax

  • Incoming payments posting without clearing the customer open item

    Hi, Is there a way to post an incoming payment to a customer and let it sit as an open item? I want to segregate the posting and clearing of AR payments. One user posts the payments to the customer account. Another user clears this payment against an

  • Moving Video Clips

    For some reason, I cant not drag movie clips from the event library to the project library. I can only add them using the add to the last clip button. What am I doing wrong? Thanks, Jim

  • Dark Knight Sync

    I bought the Dark Knight DVD that came with a digital copy and down loaded it into iTunes. But when I sync my 5th gen iPod the movie almost finishes transfering and errors out. Is it only compatable with the iPhone and touch? I found out the first ti

  • Most efficient way to constantly read, queue and parse multi-size​d RS232 data (multi-thr​eaded)

    I've tried tackling this problem a few different ways, and figured it was time to get some others' advice.  My system essentially works, although it looks like a hackjob and not entirely confident. My RS-232 connection has the following properties/co