PowerShell remoting: Results not returned using Enter-PSSession vs Invoke-Command???


so code generates output when using enter-pssession same code not return data using invoke-command (using credssp) script.

here is the relevant excerpt script:

able use get-spweb.recylce() method when using enter-pssession turn code script invoke-command not access method.  gives?  still logged in same user.  suppose permissions issue login never changed

if ((get-pssnapin microsoft.sharepoint.powershell -erroraction silentlycontinue) -eq $null) {       add-pssnapin microsoft.sharepoint.powershell     }      $webapps = (get-spwebapplication | % {$_.url})     $listtemplate = [microsoft.sharepoint.splisttemplatetype]::documentlibrary     foreach ($webapp in $webapps) {       $appdetails = get-spwebapplication $webapp       $appdetails.grantaccesstoprocessidentity("$env:userdomain"+"\$env:username")       $spweb = get-spweb -identity $webapp       $doclibname = "msotest$($appdetails.displayname)".split(".")[0]       $doclibname += "_documentlibrary"                    try {          $library = $null         $library = $spweb.lists["$doclibname"]       }       catch {out-null}              if ($library) {         #if document library exist, delete         $spfolder = $spweb.getfolder("$doclibname")          $spfolder.recylce() | out-null       } 



are sure recylce() ??

how recycle() ??



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

directory stack

After enabling Windows Server 2012 R2 DHCP Failover Getting Packet dropped because of Client ID hash mismatch

WMI Repository 4GB limit - Win 2003 Ent Question