Power Shell Remoting $Using variable scope

I have folder c:\test where I have three files: “file1”, “file2”, “file3”
Following script:
$remoteSession = New-PSSession -ComputerName localhost
$folder = "c:\test"
$exclude =@("c:\test\file1","c:\test\file2")
Invoke-Command -Session $remoteSession -ScriptBlock {
#$Using:exclude
Get-ChildItem -Path $Using:folder -recurse | Where {$Using:exclude -notcontains $_.FullName}
Remove-PSSession $remoteSession
Gives the result: file1,file2,file3
Clearly it seems that However, if I uncomment “$Using:exclude” I get the result: See
file3
Suddenly exclude list starts working properly

Hi Anna
Can you please check if this is a bug with powershell ?
Please note that uncomment 
#$Using:excludethen PowerShell starts working .Please also note that $Using:exclude has been used in next statement so according to documentation it should works

Similar Messages

  • Power Shell Command using CSOM

    Hi,
    We have prepared a Power Shell command using Client Side scripts as per client requirements. The client did not had access to the SharePoint Server. So, PS commands with
    server side scripts was out of scope. 
    The client requirement was to delete all the permissions on the list that was being inherited from site. Since the number of users were huge, so deleting all the users using ribbon was not possible.
    Please have a look at the scripts below and let me know your feedback. If you have better suggestion than this, please let me know.
    #location of client dlls on users' local system
    $loc = "C:\SharePoint\ClientDLL" 
    //SharePoint Site URL
    $siteUrl = "" 
    #Write your Login ID
    $loginname = "" 
    #Write the Name of the List
    $listname = "" 
    Set-Location $loc 
    Add-Type -Path (Resolve-Path "Microsoft.SharePoint.Client.dll")
    Add-Type -Path (Resolve-Path "Microsoft.SharePoint.Client.Runtime.dll") 
    Write-Host "Please enter password for $($siteUrl):"
    $pwd = Read-Host -AsSecureString
    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl) 
    Try
    # Remove or replace line below to change authentication method
    $ctx.Credentials = New-Object System.Net.NetworkCredential($loginname, $pwd) 
    $web = $ctx.Web
    $ctx.Load($web)
    $ctx.ExecuteQuery() 
    #Write-Host "Current web title is '$($web.Title)', $($web.Url)"  
    $list = $Web.Lists.GetByTitle($listname); 
    $ctx.Load($list); 
    $ctx.ExecuteQuery(); 
    Write-Host "Deleting Permissions on List : $($list.Title)" 
    if($list.HasUniquePermissions)
                    #Write-Host "Has Unique Permissions"
                    $list.ResetRoleInheritance()
                    $list.BreakRoleInheritance($false, $true)
                    Write-Host "Permissions deleted" -foregroundcolor Green
    if(-not $list.HasUniquePermissions)
                    #Write-Host "Does not has Unique Permissions"
                    $list.ResetRoleInheritance()
                    $list.BreakRoleInheritance($false, $true)
                    Write-Host "Permissions deleted" -foregroundcolor Green
    Catch
                    Write-Host "Some Error, Please Contact Administrator" -foregroundcolor Red
                    return
    $list.Update() 
    $ctx.ExecuteQuery();​
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

    Hi Sudheer,
    In Client-Side, we can also use .NET Client Object Model to achieve your requirement.
    Remove permission in Sharepoint List using Client Object Model
    https://rambabualaparthi.wordpress.com/2013/12/30/remove-permission-in-sharepoint-list-using-client-object-model/
    In order to better manage SharePoint in Client side, I suggest develop a Winform or WPF application and use .Net Client Object Model to achieve some requirements.
    Best Regards
    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]

  • Remote managment Exchange 2013 SP1 from C# code using Power-Shell.

    Hello,
    Sorry if I am describing something wrong, but it is first time I am using Microsoft development forum.
    I am trying to built library that will manage Exchange remotely using  C# code (VS 2012) and Power-Shell ver.4.0. My workstation and the actual Exchange server physically placed in different domains. In order to test functionalities I am using
    user that is member of all administrating and management groups in the appropriative domain. Remote Power-Shell is enabled on Exchange.
    In order to connect to the Service I am using that part of code :
    internal static bool RedirectionUrlValidationCallback(string redirectionUrl)
    bool result = false;
    var redirectionUri = new Uri(redirectionUrl);
    if (redirectionUri.Scheme.Equals("https"))
    result = true;
    return result;
    internal static ExchangeService ConnectToService(ExchangeVersion version,
    string userName,
    string emailAddress,
    string password,
    string domainName,
    ref Uri autodiscoverUrl)
    ExchangeService service;
    try
    service = new ExchangeService(version);
    service.Credentials = new WebCredentials(userName, password, domainName);
    if (autodiscoverUrl.IsNull())
    var ads = new AutodiscoverService();
    // Enable tracing.
    ads.TraceEnabled = true;
    // Set the credentials.
    ads.Credentials = service.Credentials;
    // Prevent the AutodiscoverService from looking in the local Active Directory
    // for the Exchange Web Services Services SCP.
    ads.EnableScpLookup = false;
    // Specify a redirection URL validation
    //callback that returns true for valid URLs.
    ads.RedirectionUrlValidationCallback = RedirectionUrlValidationCallback;
    // Get the Exchange Web Services URL for the user’s mailbox.
    var response = ads.GetUserSettings(emailAddress, UserSettingName.InternalEwsUrl);
    // Extract the Exchange Web Services URL from the response.
    autodiscoverUrl = new Uri(response.Settings[UserSettingName.InternalEwsUrl].ToString());
    // Update Service Url
    service.Url = autodiscoverUrl;
    else
    service.Url = autodiscoverUrl;
    catch (FormatException fe) // The user principal name(email) is in a bad format. UPN format is needed.
    LoggingFactory.LogException(fe);
    return null;
    catch (AutodiscoverLocalException ale)
    LoggingFactory.LogException(ale);
    return null;
    catch (Exception e)
    LoggingFactory.LogException(e);
    return null;
    return service;
    Then I am trying to reach existing mailbox of that user, using this part of code :
    try
    var runSpace = getRunspace();
    var pwShell = PowerShell.Create();
    pwShell.Runspace = runSpace;
    var command = new PSCommand();
    command.AddCommand("Get-Mailbox");
    command.AddParameter("Identity", userPrincipalName);
    command.AddParameter("RecipientTypeDetails", recipientType);
    pwShell.Commands = command;
    var result = pwShell.Invoke();
    if (result.IsNotNull() && result.Any())
    // TODO : fill appropriative DTO and return it.
    else
    // TODO : send back appropriative error.
    closeRunSpace(runSpace);
    catch (Exception e)
    // TODO : log the exception and send back appropriative error.
    private Runspace getRunspace()
    var runSpaceConfig = RunspaceConfiguration.Create();
    var runSpace = RunspaceFactory.CreateRunspace(runSpaceConfig);
    PSSnapInException snapEx;
    var psInfo = runSpaceConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out snapEx);
    runSpace.Open();
    return runSpace;
    private void closeRunSpace(Runspace runSpace)
    runSpace.Close();
    runSpace.Dispose();
    With this part I had problem. I received exception that appropriative Snap-in is not installed on my computer. I had no installation disk of Exchange in order to install Management Tool (as I understand this is the way to add needed part) so I changed run
    space activation to that part of code :
    private Runspace getRunspace()
    var newCredentials = (PSCredential)null;
    var connectionInfo = new WSManConnectionInfo(new Uri("http://exchange.domainname.local/powershell?serializationLevel=Full"),
    "http://schemas.microsoft.com/powershell/Microsoft.Exchange",
    newCredentials);
    connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
    var runSpace = RunspaceFactory.CreateRunspace(connectionInfo);
    runSpace.Open();
    return runSpace;
    Now I am receiving exception :
    "Connecting to remote server exchange.domainname.local failed with the following error message :
    [ClientAccessServer=exchange,BackEndServer=exchange.domainname.local,RequestId=....,TimeStamp=...]
    Access is denied. For more information, see the about_Remote_Troubleshooting Help topic."
    Please help me to understand what I am doing wrong.
    Thank you.
    Alexander.

    In Exchange 2010 you should be using Remote Powershell not local powershell and the snap-in.  Here is a sample that may help you:
    http://blogs.msdn.com/b/dvespa/archive/2009/10/22/how-to-call-exchange-2010-cmdlet-s-using-remote-powershell-in-code.aspx

  • How to get site permissions using power shell ?

    Hello,
    I require to get list of granted permissions ( Group/users ) which we see from Site Actions > Site Permissions.
    would you please let me know how can I fetch the same using power shell ?
    Thanks and Regards,
    Dipti Chhatrapati

    Hello,
    I have found the same using following script :
    if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { 
    Add-PSSnapin "Microsoft.SharePoint.PowerShell" 
    #Define variables 
    $site = Get-SPSite "Site collection URL"
    #Get all subsites for site collection 
    $web = $site.AllWebs
    #Loop through each subsite and write permissions
    foreach ($web in $web) 
    if (($web.permissions -ne $null) -and ($web.hasuniqueroleassignments -eq "True")) 
    Write-Output "****************************************" 
    Write-Output "Displaying site permissions for: $web" 
    $web.permissions | fl member, basepermissions 
    elseif ($web.hasuniqueroleassignments -ne "True") 
    Write-Output "****************************************" 
    Write-Output "Displaying site permissions for: $web" 
    "$web inherits permissions from $site" 
    Write-Host "Finished." 
    $site.dispose() 
    $web.dispose()
    Hope it helps others !
    Thanks and Regards,
    Dipti
    Dipti Chhatrapati

  • Remote power-shell connectivity

    got below error when trying to connect to remote SharePoint server through power shell.
    Steps:
    Enable-WSManCredSSP -Role client -DelegateComputer servername.domain.com
    winrm quickconfig
    Enable-WSManCredSSP -Role server
    $farm = Get-Credential
    $s = New-PSSession -ComputerName servername.domain.com -Authentication CredSSP -Credential $farm
    Invoke-Command -Session $s -ScriptBlock { add-pssnapin Microsoft.SharePoint.PowerShell -ea 0 }
    Invoke-Command -Session $s -ScriptBlock { get-spfarm }
    Invoke-Command -Session $s -ScriptBlock { get-spcontentdatabase }
    Get-PSSession | Remove-PSSessioncmd
    Error:
    The WinRM client cannot process the request. The authentication mechanism requested by the 
    client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the 
    unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported 
    by the server.  To use Kerberos, specify the computer name as the remote destination. Also verify that the client 
    computer and the destination computer are joined to a domain. To use Basic, specify the computer name as the remote 
    destination, specify Basic authentication and provide user name and password. Possible authentication mechanisms 
    reported by server:     Negotiate Kerberos For more information, see the about_Remote_Troubleshooting Help topic.
    At D:\RAASSP\targetserverCheck.ps1:2 char:6
    + $s = New-PSSession -ComputerName hsv-vplusapp.virtusa.com -Authentication CredSS ...
    sudesh withanage

    Hi this is how I got it working:
    For the Server:
    On the domain controller open "Active Directory Users and Computers". Under "Computers" find the servername and right click properties, on Delegation Tab select "Trust this computer for delegation any service (Kerberos Only)"
    And then from powershell:
    $domainAdminCred = Get-Credential
     Start-Job -ScriptBlock {
            Enable-PSRemoting -Force 
      Enable-WSManCredSSP -Role Server -Force 
        } -Credential $domainAdminCred -Argumentlist servername.domain.com | Wait-Job | Receive-Job
    Enable-WSManCredSSP -Role Client -Delegate servername.domain.com -Force
    Connect-WSMan servername.domain.com
    Set-Item "WSMan:\$server*\Service\Auth\CredSSP" -Value $true
    $farm = Get-Credential
    $session = New-PSSession -ComputerName servername.domain.com -Authentication CredSSP -Credential $farm
    Invoke-Command -Session $session -ArgumentList $path -ScriptBlock {   
            if (-not(Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue))
                Add-PSSnapin Microsoft.SharePoint.Powershell
            Get-SPFarm
    Hope it helps

  • Exchange 2013 CU5 , Exchange Power Shell very very very slow reasponse when using get command.

    Exchange 2013 CU5 , Exchange Power Shell very very very slow reasponse when using get command.
    First my organize has Exchange on 2 site like
    site A (internet facing) : 2CAS 2 MB all are Services pack1
    site B (DR Site , no user active on this site) : 2CAS 2MB all are Services pack 1
    so today I upgrade Exchange 2013 from SP1 to CU5 start on "site B" and I found this issue and the details is....
    When I open EMS on any CU5 for query something (like get-mailboxdatabasecopystatus) the response return very slow and some query will not return at all (like get-owavirtualdirectory).
    But If I using EMS on SP1. Everything is ok then I try to use EMS on SP1 connect to CU5 and try to query something. the result is
    some query command cannot return for any result that are server on siteB (just some query command)
    Problem
    EMS on CU5 return very slow result.
    EMS on SP1 still ok.
    Does anyone face this problem before for CU5??? Please help me figure this out. Thank you
    reply from Social.technet

    Hi,
    Have you used the above cmdlets to check your Exchange server health?
    "all other command that I ran on EMS didn't logged on event viewer.", my environment is the same with you. I use Exchange 2013, only errors will be displayed in MSExchange Management. Actually, it is not related to slow EMS response.
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Add or delete the summary links web part's[deployed as a VS solution] link using power shell

    hi,
     i am having a visual studio custom solution having page layouts implemented. In that solution i am having 1  summary links web part and in that i have hard coded few links and this is  deployed on ion dev and staging env.
    Now, the issue is : yesterday, customer came to me and asking me to change the links from http://abc to
    http://xyz/ in this summary links. can anyone pls throw some light,such that i can change this link using a power shell script. i know  if i go the VS solution and change the link and redeploy [ update-spsolution
    command] will work.
    but if the links are changing regularly , chnaging the vs solution and redeploying is not a good practice.
    if i elaborate li'l bit,  i am adding the screen shot : i need to get the summary link column's value and  need to update[ delete xisting one and  add new ones ]
    is there any way , i can change the links using power shell script?
    i tried the belwo power shells cript to get the page in the page layouts :
    $web = get-spweb
    "http://siteurl"
    $pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $pagesListName = $pubWeb.PagesListName
    $defaultAspxFile = $pubWeb.GetPublishingPage("$pagesListName/mycustomhome.aspx")
    $summaryLinkFieldValue = New-Object
    Microsoft.SharePoint.Publishing.Fields.SummaryLinkFieldValue
    // here am getting the NULL VALUE
    can i get the  summary links field correctly and  delete / modify the same?
    help is appreciated!
    ##$groupLink = New-Object
    Microsoft.SharePoint.Publishing.SummaryLink("My group")
    #$groupLink.IsGroupHeader = $true $summaryLinkFieldValue.SummaryLinks.Add($groupLink)

    Hi Shabeaut,
    Could you tell us why do you want to add a link web part to the master page for all pages?
    I tested that Summary Links web part (and other types of web parts) added in the master page under Quick Launch couldn't be edited when I edit the pages inherited from v4.master page, it looks by design.
    Have you tried using the Quick Launch to add the link instead if you want to show links in all pages.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Trying to run program off network location using GPO with Power shell script.

    Hello All,
    Not much of a script writer. I am giving it a shot.  My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
    to run the program with elevated privileges. 
    Little background:
    We are running on a domain and end users do not have admin rights.
    The application is stored on a share on our network that is open to all domain users.
    The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
    So this is what I have so far.
    $username = "USER"
    $password = "PASSWORD"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
    But for some reason I keep getting :
    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:10 char:1
    + Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    Any help you could give would be great.
    Thanks,
    jdfmonkey

    Hi jdfmonkey,
    Has anyone provided an answer to your original question?  I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
    $cred=Get-Credential
    start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
    I get the same error that you mentioned:
    start-process : This command cannot be run due to the error: The system cannot find the file specified.
    At C:\Scripts\Process.ps1:2 char:1
    + start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
    When I leave off the credentials:
    start-processProcess.exe-WorkingDirectoryC:\Scripts
    It works correctly.  Does anyone have a solution to make this work correctly?
    Please ask your own question.  You issue is nothing like the current thread.  You clearly are using a user account that has no access to the folder.  It is a permissions issue.  It is not a scripting issue.
    If you need further help please start your own question.
    ¯\_(ツ)_/¯

  • New-CMGlobalCondition unable to create New script Condition using Power Shell

    I am using config Manger 2012 and trying to use power shell cmdlet to create a new Global Condition using PowerShell but its not working for me using this
    Do not understand how to use that command any idea.
    New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 -Name test -ScriptLanguage PowerShell
    Error comes as 
    New-CMGlobalCondition : No object corresponds to the specified parameters.
    At line:1 char:1
    + New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 - ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Confi...onditionCommand:NewGlobalConditionCommand) [New-CMGlobalCondition], I 
       temNotFoundException
        + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.AppModel.Commands.NewGlobalConditionCommand

    Hi,
    What's your version of SCCM? I ran this command line on SCCM 2012 R2 CU2.
    It seems SCCM 2012 R2 CU2 fixed New-CMGlobalCondition cmdlet issue.
    "The New-CMGlobalCondition cmdlet incorrectly requires use of the
    -WhereClause parameter."
    Description of Windows PowerShell changes in Cumulative Update 2 for System Center 2012 R2 Configuration Manager
    Best Regards,
    Joyce

  • Create & Start UPS Service Using Power-Shell in SharePoint 2013

    I want to know that is there a way to create a User Profile Synchronization Service using Power-Shell in a SharePoint 2013 Enterprise site? If so then how am I supposed to do that and start the User Profile Synchronization Service using the Power-Shell.
    I'm seeking this help because the UPS service is stuck in Starting and both FIM Services are also not started but they are in Automatic start mode.
    Could someone try to solve this matter.
    Thanks,
    regards,
    Chiranthaka

    start it from powershell will not help you resolve the issue.
    Try below articles:
    http://myspexp.com/2011/04/28/user-profile-synchronization-servicehangs-on-starting-i-fixed-it/
    troubleshoot this issue:http://www.harbar.net/articles/sp2010ups2.aspx
    http://www.sharepointdiary.com/2012/09/user-profile-synchronization-service-stuck-at-starting.html#ixzz2aXArH7zX

  • Using Power shell script how to hidden SharePoint existing features.

    Hi Firends,
    Using Power shell script how to hidden SharePoint existing features.
    Please help me.
    Thanks,
    Tiru
    Tiru

    The Hidden property is set within the solution, so you would need access to the source code in order to set it.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Deploy wsp through Power Shell- start stop SP admin service and run execadmsvcjobs command using power shell

    Hi,
     Can anyone pls point me any link/ src code  for  deplyoing wsp using power shell. I know I can deploy it through Add-spsolution and install-spsolution, the issue is that, it will give   "status - stuck in deploying scheduled..."
    and i need to restart the sharepoint services - services.msc --> SP administration and timer services - and then i need to run the exceadmsvcjobs command to deploy / update the wsp  successfully in solution store.
    i mean, whats the power shell equivalent of these tasks. or anyone has already scripted these.
    if i elaborate little bit, would like to know how to automatically Retract, Remove, Add and Deploy SharePoint 2010 WSP Solution Files with PowerShell

    ok, i have found  the same :
     here its : hope this will help someone.
    function wait4timer($solutionName)
    $solutionName ="TestingWSP.wsp"
    $solution = Get-SPSolution | where-object {$_.Name -eq $solutionName}
    if ($solution -ne $null)
    Write-Host "Waiting to finish soultion timer job" -ForegroundColor Green
    while ($solution.JobExists -eq $true )
    Write-Host "Please wait...Either a Retraction/Deployment is happening" -ForegroundColor DarkYellow
    sleep 5
    Write-Host "Finished the solution timer job" -ForegroundColor Green
    try
    # Get the WebApplicationURL
    $MyWebApplicationUrl = "http://srvr:21778/";
    # Get the Solution Name
    $MywspName = "TestingWSP.wsp"
    # Get the Path of the Solution
    $MywspFullPath = "D:\myWorkspace\TestingWSP.wsp"
    # Try to get the Installed Solutions on the Farm.
    $MyInstalledSolution = Get-SPSolution | Where-Object Name -eq $MywspName
    # Verify whether the Solution is installed on the Target Web Application
    if($MyInstalledSolution -ne $null)
    if($MyInstalledSolution.DeployedWebApplications.Count -gt 0)
    wait4timer($MywspName)
    # Solution is installed in atleast one WebApplication. Hence, uninstall from all the web applications.
    # We need to unInstall from all the WebApplicaiton. If not, it will throw error while Removing the solution
    Uninstall-SPSolution $MywspName -AllWebApplications:$true -confirm:$false
    # Wait till the Timer jobs to Complete
    wait4timer($MywspName)
    Write-Host "Remove the Solution from the Farm" -ForegroundColor Green
    # Remove the Solution from the Farm
    Remove-SPSolution $MywspName -Confirm:$false
    sleep 5
    else
    wait4timer($MywspName)
    # Solution not deployed on any of the Web Application. Go ahead and Remove the Solution from the Farm
    Remove-SPSolution $MywspName -Confirm:$false
    sleep 3
    wait4timer($MywspName)
    # Add Solution to the Farm
    Add-SPSolution -LiteralPath "$MywspFullPath"
    # Install Solution to the WebApplication
    #Install-SPSolution -Identity <SolutionName> -WebApplication <URLName> [-GACDeployment] [-CASPolicies]
    install-spsolution -Identity $MywspName -WebApplication $MyWebApplicationUrl -GACDeployment #-FullTrustBinDeployment:$true -GACDeployment:$false -Force:$true
    # Let the Timer Jobs get finishes
    wait4timer($MywspName)
    Write-Host "Successfully Deployed to the WebApplication" -ForegroundColor Green
    catch
    Write-Host "Exception Occuerd on DeployWSP : " $Error[0].Exception.Message -ForegroundColor Red
    ref :
    http://www.sharepointpals.com/post/How-to-Deploy-a-SharePoint-2013-Solution-(WSP)-in-the-Farm-using-PowerShell

  • Get the web part properties of documeny lib view web part using power shell

    Hi,
    Am looking to get the propeties of a list view web part - a document library's  list view web  part- using PowerShell
    Manually I am able to do the same: the steps followed by me is given below:
    1) I went to the
    http://srvr1:123/sites/enggtest/mydoclib1/forms/allitems.aspx
    2) Edit the page
    3) Edit the  mydoclib1 view web part
    4) go to the peroperties
    5) Check the Server Render checkbox
    is there   anyway i can do this using power shell.

    The code below assumes that the webpart is at index 0:
    $SiteUrl = "http://aissp2013/sites/TestSite/"
    $pageURL = "http://aissp2013/sites/TestSite/Lists/MyList/AllItems.aspx"
    $web = Get-SPWeb $SiteUrl
    $wpm = $web.GetLimitedWebPartManager($pageURL, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    $wp = $wpm.WebParts[0]
    $wp.ServerRender = $true
    $wpm.SaveChanges($wp)
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • IIS Issue:when trying to download code from AWS S3 and deploy in IIS server using Power Shell script while Windows startup Default Application pool is not started.

    Hi,
    I am trying to launch Amazon EC2 windows server 2008 R2 instance using AWS Auto Scaling feature. I have used cusmized AMI in Autoscaling Launch configuration to launch an instance.I have placed Power Shell script in AMI. 
    The responsibility of script is to download code from AWS S3 and deploy in IIS server while windows startup first time.
    When i check status, IIS is started succesfully. But default Application pool is not started.
    To resolve this issue i have written one scheduled script. It helps to start the application pool if any application pool is in stopped state.
    After this Application pool is started but i am not able to communicate with IIS server through browser.  
    Please help any one to resolve this issue.
    Thanks in advance

    Hi Vchreddy,
    For the IIS issue, we recommend you can post in IIS forum for more effective support:
    http://forums.iis.net/
    Thanks for your understanding.

  • Activate design manager (sandbox) solution using power shell - SP2013

    Hi All,
    I have a  design manager (sandbox) solution and deployed in site collection. I am trying to upload the new version using power shell.
    Uninstall-SPUserSolution , Remove-SPUserSolution, Add-SPUserSolution and finally doing Install-SPUserSolution on that time i am getting the following error " Install-SPUserSolution : This file may not be moved, deleted,
    renamed, or otherwise edited." kindly help me for this issue.
    Regards,
    Santhosh

    Can you please provide more details on your solution package? Did you use SharePoint Design Manager to create design package? If that is the case then if you read the following article it reads and 
    "In SharePoint 2013 you cannot uninstall an imported design package, and you should never attempt to deactivate a design package through the solution gallery." 
    I think if you read the article it might be helpful.
    http://msdn.microsoft.com/en-us/library/jj862342.aspx
    Amit

Maybe you are looking for

  • How can I reset my iCloud account without deleting all my contacts and photos on my iPhone.

    How can I reset my iCloud account without losing all my photos and contacts on my phone. I just want to clean up my iCloud.

  • What's Wrong with the Artwork Feature?

    I used to have all my files saved with artwork, but lately, I've been having files lose their artwork and some files don't seem to save artwork no matter how I put it in (either through right click and paste or info). There's nothing wrong with the f

  • Configuration on domain name inside Business Catalyst

    I created a web site in Muse and using Business Catalyst to upload this site. I purchased the url (domain name) from godaddy.com. Currently, the domain is parked at godaddy.com and I need a DNS to re-route the site back to Adobe Business Catalyst.. h

  • Date sorting in internal table

    Dear Friends    I wish to know how i perform the date operations in internal table... I am looking for the most recent record from the internal table for that i am supposed to look at chdate and chtime fields gives me the information on most correntl

  • How to set a different output format as part of the Concurrent request

    We are on EBS 11.5.10.2 and we are also using XML Publisher 5.6.2. We have few Excel output reports. The issue we are having is that when we defien these reports as a concurrent program, the options for output always defaults to PDF. The end user has