Windows 10: why does my computer have the PowerShell application?

My computer will have a PowerShell pop-up application that never happened until recently, I have no idea what it does, it just stays there on my screen for a few minutes and nothing happens, it just doesn't respond and I end up having to finish the process to get rid of the. My computer will also die when it is not near the hibernation point or warns me about the energy level, it will only perform the action of holding down the power button where the normal shutdown process is not performed, it simply stops.

Create list in SP OnLine with C # or PowerShell

Using REST of C # or almost anything …

URL: https://yourDomain/sites/yourSite/_api/web/lists

Header:

{"accept": "application/json;odata=verbose",
                   "content-type": "application/json;odata=verbose",
                   "content-length":__len__,
                   "X-RequestDigest": "__yourRequestDigest__"}

Body:

{"__metadata": { "type": "SP.List" },
               "AllowContentTypes": true,
               "BaseTemplate": 100,
               "ContentTypesEnabled": true,
               "Description": "My list description",
               "Title": "My List Title" }

The real work here is the permissions and / or the RequestDigest token. The "how" depends on where your request originates.

powershell – Modifying Get-MyBios

I try to delete the start and end statements to modify the script to Get-MyBios in PowerShell ISE and I don't know where to remove it from this code:

Param
(
    #name of remote computer
    ( Alias("cn") )
    (Parameter(ValueFromPipeline=$true,
               Position=0,
               ParametersetName="remote"))
    (string)
    $ComputerName)

Can anyone tell me how?

sql server 2014: how to create a job that uses the Powershell script?

I have a PowerShell script that removes old backup copies of NAS storage. I've already tried it with Windows Powershell and it works, but I couldn't do the same in SQL Server. I created a job of type cmdExec and then wrote the script below (the script is on the desktop):

"C:Windowssystem32WindowsPowerShellv1.0powershell.exe"

"C:UsersdomainAccountDesktop"

".deleteold.ps1 -FolderPath \192.168.x.xBackups -FileAge 2 -ListOnly -LogFile \192.168.x.xBackupslog.log"

But I don't get any results, since when I execute the work, it keeps running infinitely until I stop it.

powershell – SharePoint Online Add cross-site search with PnP and XML

I am trying to set up a cross-site search field using XML (what I could do in previous local SharePoint environments). However, I have some difficulty creating a similar configuration in my tenant-based environment of SharePoint Online.

My destination settings have the following details:

  1. Two (modern) team sites, both at the same site level, and both associated with a
    Team site (hub).
  2. SiteA has a list of projects / products.
  3. SiteB has a list of records that contain a search field that should point to the list of projects in SiteA.

Right now, I'm just trying to create a site column in SiteB that will be a search field that points to the List of projects in SiteA. As I know that this configuration cannot be done in the OOB user interface, I am using the PowerShell 5.1 commands and the PnP library cmdlets to do it through XML. When I run the lines below, a site column is created on site B, but it doesn't really seem to be connected to the project list (site A), so there are no values ​​when I use it to create a column in a list. I have also tried to directly create a column in a list (to see if that would work better).

For the XML below, I am specifying the GUID of the list in SiteB that contains the list of projects and the GUID of the web context for SiteB. I am using NewGuild to generate a new GUID for the new site column.

Some samples of my PS code:

$newguid = (GUID)::NewGuid()

$fieldXML = ''

Add-PnPFieldFromXml -FieldXml $fieldXML

One thing that I have noticed (and that has intrigued me) is that when I use Get-PnPWeb to get (what I think it is) the WebID, the returned GUID is exactly the same for SiteA and SiteB. I have used separate PowerShell consoles to extract information from sites separately to make sure that the commands work in the correct sites. So, I wonder if I am using the correct GUID in my XML (for WebId) to point to the Web (or site) that contains the list of projects.

I will continue to try things, but I hope someone can have some suggestions or ideas on how to configure XML for SharePoint Online and establish successful cross-site search.

UPDATE to the original question

I have continued working on this topic. I had been working with two Team sites that are associated with a Hub site. But then I decided to try to work with two different Team sites, not associated with any Hub sites. In this case, the WebID (LookupWebIDs) were different from each other. Then, I reconfigured my XML and used Add-PnPFieldFromXML that created a new Site column (without errors), and the property values ​​for the new column were checked out as desired.

$fieldXML = ‘’

Add-PnPFieldFromXML -fieldXML $FieldXML (to create the new Test Column on Site A)

*Check properties*
PS C:> $testCol.LookupList
{9e887b1f-12ad-4feb-a1f8-a9fe5d15b6ab}
PS C:> $testCol.LookupWebID

Guid
----
8ff42b00-5858-4f6d-8295-80aff7950373

But when I tried to use the new column in a list, the drop-down menu has no values ​​(it should be 3 values), so it still doesn't seem to connect correctly to the list elsewhere.

UPDATE 2: A possible solution
———————————–

Finally I was able to obtain the ability between sites using PowerShell / GUID / XML to set the SchemaXML property of a search field in my list (SiteB) to point to the list of values ​​(SiteA). The GUIDs for List, WebID and SourceID were set to values ​​between sites and everything worked as expected. However, I first had to create a collection of classic sites (in my online tenant) to be able to create two team sites with the classic SharePoint team site template.

No matter what I tried, I couldn't get the inter-site capability to work with a Modern Team Site template. For me, it only seems to work on sites created with the Classic template. It is still important to find a solution that allows the ability to search between sites using modern settings, so this problem has not yet been resolved. I just wanted to share what worked, in case it helps someone else.

Remove more than 5000 items SharePoint Online Powershell

I am trying to remove approximately one million items from a SharePoint online library. I think the following code (found on the web) combines this with <5000 elements, but still fails with the error:
Error removing items from the list! Exception that calls "ExecuteQuery" with arguments "0": "The operation attempt is prohibited because it exceeds the list view threshold imposed by the administrator."

Are you using CAML but I think you are deleting one file at a time?
I can't even delete the library! Any idea why?

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.dll"
Add-Type -Path "C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions16ISAPIMicrosoft.SharePoint.Client.Runtime.dll"

#Config Parameters
$SiteURL= "https://mysite/sites/subsite"
$ListName="Mylist"
$BatchSize = 500

#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

Try {
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Cred

    #Get the web and List
    $Web=$Ctx.Web
    $List=$web.Lists.GetByTitle($ListName)
    $Ctx.Load($List)
    $Ctx.ExecuteQuery()
    Write-host "Total Number of Items Found in the List:"$List.ItemCount

    #Define CAML Query
    $Query = New-Object Microsoft.SharePoint.Client.CamlQuery
    $Query.ViewXml = "$BatchSize"

    Do { 
        #Get items from the list in batches
        $ListItems = $List.GetItems($Query)
        $Ctx.Load($ListItems)
        $Ctx.ExecuteQuery()

        #Exit from Loop if No items found
        If($ListItems.count -eq 0) { Break; }

        Write-host Deleting $($ListItems.count) Items from the List...

        #Loop through each item and delete
        ForEach($Item in $ListItems)
        {
            $List.GetItemById($Item.Id).DeleteObject()
        }
        $Ctx.ExecuteQuery()

    } While ($True)

    Write-host -f Green "All Items Deleted!"
}
Catch {
    write-host -f Red "Error Deleting List Items!" $_.Exception.Message
}

powershell: why is this exception shown in Windows 7?

The following code is written in Visual Studio 2015 using PowerShell in C #.

using (PowerShell PowerShellInstance = PowerShell.Create())
{
                    PowerShellInstance.AddScript(script);
                    Collection PSOutput = PowerShellInstance.Invoke();
}

When the following line of code is executed

Collection PSOutput = PowerShellInstance.Invoke();

He is giving me the next exception.

The type initializer for & # 39; System.Management.Automation.PSVersionInfo & # 39; threw an exception.

I am trying to execute this PowerShell instruction in Windows 7, but it is not allowed.

Why is this exception shown? and how can i fix it?

PnP Powershell Online code conversion to SharePoint 2013

I wrote a code with PnP PowerShell for SharePoint Online, but now I need to port it to SharePoint 2013. While I had full control over SharePoint Online, I don't have administrator rights for SharePoint 2013.

The following code simply iterates through a collection of sites and subnets and finds lists that support a particular type of content. Then generate the content of each list in a Report.

I am confused about connecting to SharePoint locally. Online I am using:

 Connect-PnPOnline -Url $sourceUrl -CurrentCredentials

Assuming SharePoint 2013 runs Powershell 5.1, apart from the connection, isn't there really much to change? Is there?

 Get-SPOnlineFileDetails -sourceUrl "http://intranet.xxxx.gov/km/" -Recurse $true -IncludeFileSize $true | Export-Csv -NoTypeInformation -Path "C:UserswxmuldomDocumentsDataSPOnlineDetails.csv"

    function Get-SPOnlineFileDetails()
    {
        Param(
            (Parameter(Mandatory=$true,ValueFromPipeline, HelpMessage="SharePoint Online source site URL"))
            (String)
            $sourceUrl,
            (bool)
            $Recurse,
            (bool)
            $IncludeFileSize      
        )
        Process{
             Write-Host "###################### Pull Details From SharePoint Online ######################" -ForegroundColor Green
             Write-Host "Provided Source URL :"$sourceUrl -ForegroundColor Green
             try{

                     Connect-PnPOnline -Url $sourceUrl -CurrentCredentials
                     $web = Get-PnPWeb

                     PopulateData -web $web -incldeFileSize $IncludeFileSize

                     if($Recurse -eq $false){
                         Get-PnPSubWebs | %{
                          PopulateData -web $_ -incldeFileSize $IncludeFileSize                   
                         }
                     }
                     else{
                         Get-PnPSubWebs -Recurse | %{
                          PopulateData -web $_ -incldeFileSize $IncludeFileSize                   
                         }
                     }
                }
                catch{
                Write-Host $_.Exception.Message -ForegroundColor Red
                }

        }
    }

    function PopulateData($web, $incldeFileSize){
            Write-Host "Current Site " $web.url -ForegroundColor Cyan 
                      $libs = Get-PnPList -Web $web | Where{($_.BaseType -eq “DocumentLibrary”) }

                      foreach($lib in $libs){
                         $libitems = (Get-PnPListItem -Web $web -List $lib -Fields "FileLeafRef","Name","Title","Author","Modified","Created","KBAbstract","KBContentAuthor","KBCategory","Publish","KBPublishDate").FieldValues

                           foreach($libitem in $libitems)
                             {
                                 if($libitem.FSObjType -eq "0"){
                                  $data = @{
                                              "Web Name" = $web.Title

                                              "Library Name" = $lib.Title
                                              "File Name" = $libitem.FileLeafRef
                                              "Abstract" = $libitem.KBAbstractMicrosoft.SharePoint.Client.FieldUserValue
                                                $value = $libitem("KBContentAuthor")
                                                $user = Get-PnPUser -Identity $value.LookupId
                                               "Content Author" = $user.Title
                                               $MMSFieldValueColl = $libitem("KBCategory") 
                                                #Concatenate each term in the value collection
                                                $MMSFieldTerms = ""
                                                Foreach ($MMSFieldValue in $MMSFieldValueColl) {

                                                    if($MMSFieldValue.label -ne $null)
                                                    {
                                                        $MMSFieldTerms+=$MMSFieldValue.label+"; "
                                                    }
                                                }
                                                Write-Host $MMSFieldTerms

                                             # "Knowledge Area" = $libitem.KBCategory
                                              "Publish" = $libitem.Publish
                                              "Published Date" = $libitem.KBPublishedDate.LookupValue
                                              "File URL" = $libitem.FileRef
                                              "Modified Date" = $libitem.Modified
                                              "Created By" = $libitem.Author.LookupValue
                                              "Created Date" = $libitem.Created
                                              "Modified By" = $libitem.Editor.LookupValue
                                              "File Size (KB)" = $null
                                         }
                                 if($incldeFileSize -eq $true){
                                        $file = Get-PnPFile -Url $libitem.FileRef
                                        $data("File Size (KB)") = $file.Length / 1KB
                                  }
                                  New-Object PSObject -Property $data
                                }
                             }
                      }       
    }

powershell: what is the realm of SharePoint authentication (on premises)?

Authentication Kingdom is established when you establish an OAuth trust with a service, such as Workflow Manager or SharePoint Add-ins.

The realm must be set to an identical value when publishing / consuming SharePoint service applications or during an update when you need to add add-ons, for example, a SharePoint 2013 server farm with SharePoint add-ons deployed, you would set the realm to an identical value in the SharePoint Farm 2016 you are updating.

Windows Server 2016 – Create storage space parity RAID using Powershell

I have an external USB enclosure that presents the physical disks to my Windows Server 2016 operating system with identical Unique IDs

As a result, I cannot use the Server Administrator UI> Storage spaces to create a "Parity" disk (because the UI only lists the first disk it sees with that unique UniqueID).

So while I wait to receive an answer about an open ticket with the provider, I am trying to use Powershell.

This website offers a good overview:
https://terrytlslau.tls1.cc/2012/10/configuring-storage-pool-by-powershell.html

But there seems to be something wrong, presumably at the time of creating the VirtualDisk.

In my case, I have five 3.64TB units that I would like to configure in "Parity" mode (RAID5).

I have successfully created a storage group (called "ExternalPool") with those five units:

Get-StoragePool -FriendlyName ExternalPool | Get-PhysicalDisk

FriendlyName       SerialNumber CanPool OperationalStatus HealthStatus Usage          Size
------------       ------------ ------- ----------------- ------------ -----          ----
Oyen Mobius Pro D2 (omitted)    False   OK                Healthy      Auto-Select 3.64 TB
Oyen Mobius Pro D3 (omitted)    False   OK                Healthy      Auto-Select 3.64 TB
Oyen Mobius Pro D4 (omitted)    False   OK                Healthy      Auto-Select 3.64 TB
Oyen Mobius Pro D5 (omitted)    False   OK                Healthy      Auto-Select 3.64 TB
Oyen Mobius Pro D1 (omitted)    False   OK                Healthy      Auto-Select 3.64 TB

The next step makes me create a VirtualDisk using the following command:

New-VirtualDisk -StoragePoolFriendlyName ExternalPool -FriendlyName ExternalDisk -Size 18.2TB -ResiliencySettingName Parity -ProvisioningType Thin

… even though "ResiliencySettingName" is "Parity", the above command results in a virtual unit of 18.2TB in available size.

In other words, it seems that space is not being reserved for storing the parity bit; I would have expected the resulting RAID5 volume to be 14.56TB in size.

So what am I missing? – I tried to specify different sizes in the "New-VirtualDisk" command, but in each case the available space does not match what would be expected for a RAID5 volume.

Thanks in advance!