Compare commits
17 Commits
beta
...
ec111816d5
Author | SHA1 | Date | |
---|---|---|---|
ec111816d5 | |||
|
8509174d91 | ||
|
327bf76a52 | ||
6f04ad15ea | |||
|
d03b93e554 | ||
8021f12d2c | |||
5139e8c598 | |||
833dd4c4ce | |||
e721c304e5 | |||
1194b87c71 | |||
44841d197c | |||
|
3a5b3fa66c | ||
|
00a54cf299 | ||
|
9927abaf81 | ||
|
7c18b41a56 | ||
|
5eb68f1858 | ||
|
d8a61d1aae |
89
Intune/UpdateForensITXML-ProfWiz.ps1
Normal file
89
Intune/UpdateForensITXML-ProfWiz.ps1
Normal file
@@ -0,0 +1,89 @@
|
||||
# Check that AzureAD is installed
|
||||
if (-Not (Get-Module -ListAvailable -Name AzureAD)) {
|
||||
|
||||
$install = Read-Host 'The AzureAD PowerShell module is not installed. Do you want to install it now? (Y/n)'
|
||||
|
||||
if($install -eq '' -Or $install -eq 'Y' -Or $install -eq 'Yes'){
|
||||
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
|
||||
{
|
||||
Write-Warning "Administrator permissions are needed to install the AzureAD PowerShell module.`nPlease re-run this script as an Administrator."
|
||||
Exit
|
||||
}
|
||||
|
||||
write-host "Installing"
|
||||
Install-Module -Name AzureAD
|
||||
}
|
||||
else {
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
# Create a temporary file to hold the unformatted results of our Get-AzureADUser query
|
||||
$TempFile = New-TemporaryFile
|
||||
|
||||
#Go ahead and attempt to get the Azure AD user IDs, but catch the error if there is no existing connection to Azure AD
|
||||
Try
|
||||
{
|
||||
Get-AzureADUser -All:$true | Export-Csv -Path $TempFile -NoTypeInformation -encoding Utf8
|
||||
}
|
||||
Catch [Microsoft.Open.Azure.AD.CommonLibrary.AadNeedAuthenticationException]
|
||||
{
|
||||
#Connect to Azure AD. This will show a prompt.
|
||||
Connect-AzureAD | Out-Null
|
||||
|
||||
#Try again
|
||||
Get-AzureADUser -All:$true | Export-Csv -Path $TempFile -NoTypeInformation -encoding Utf8
|
||||
}
|
||||
|
||||
|
||||
# Get the tennant details
|
||||
$Tenant = Get-AzureADTenantDetail
|
||||
|
||||
# Get the unformatted data from the temporary file
|
||||
$azureADUsers = import-csv $TempFile
|
||||
|
||||
# Create the XML file
|
||||
$xmlsettings = New-Object System.Xml.XmlWriterSettings
|
||||
$xmlsettings.Indent = $true
|
||||
$xmlsettings.IndentChars = " "
|
||||
|
||||
$XmlWriter = [System.XML.XmlWriter]::Create("$((Get-Location).Path)\ForensiTAzureID.xml", $xmlsettings)
|
||||
|
||||
# Write the XML Declaration and set the XSL
|
||||
$xmlWriter.WriteStartDocument()
|
||||
$xmlWriter.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='style.xsl'")
|
||||
|
||||
# Start the Root Element
|
||||
$xmlWriter.WriteStartElement("ForensiTAzureID")
|
||||
|
||||
# Write the Azure AD domain details as attributes
|
||||
$xmlWriter.WriteAttributeString("ObjectId", $($Tenant.ObjectId))
|
||||
$xmlWriter.WriteAttributeString("Name", $($Tenant.VerifiedDomains.Name));
|
||||
$xmlWriter.WriteAttributeString("DisplayName", $($Tenant.DisplayName));
|
||||
|
||||
|
||||
#Parse the data
|
||||
ForEach ($azureADUser in $azureADUsers){
|
||||
|
||||
$xmlWriter.WriteStartElement("User")
|
||||
|
||||
$xmlWriter.WriteElementString("UserPrincipalName",$($azureADUser.UserPrincipalName))
|
||||
$xmlWriter.WriteElementString("ObjectId",$($azureADUser.ObjectId))
|
||||
$xmlWriter.WriteElementString("DisplayName",$($azureADUser.DisplayName))
|
||||
|
||||
$xmlWriter.WriteEndElement()
|
||||
}
|
||||
|
||||
$xmlWriter.WriteEndElement()
|
||||
|
||||
# Close the XML Document
|
||||
$xmlWriter.WriteEndDocument()
|
||||
$xmlWriter.Flush()
|
||||
$xmlWriter.Close()
|
||||
|
||||
|
||||
# Clean up
|
||||
Remove-Item $TempFile
|
||||
|
||||
write-host "Azure user ID file created: $((Get-Location).Path)\ForensiTAzureID.xml"
|
||||
|
14
Misc/SendLogs.ps1
Normal file
14
Misc/SendLogs.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
#Connexion au Sharepoint (necessaire pour l'utilisation de l'API graph)
|
||||
Connect-PnPOnline -url https://site.sharepoint.com -interactive
|
||||
|
||||
#On precise les parametres basiques, on peut envoyer de n'importe quelle adresse mail du moment qu'elle fait partie du tenant.
|
||||
$EmailParams = @{
|
||||
From = "mail"
|
||||
To = "mail"
|
||||
Subject = "Script envoi de mails" #Titre du mail
|
||||
BodyContentType = "HTML" #Type de contenu du mail
|
||||
Body = "Test" #Contenu du corps du mail, on peut mettre ce qu'on veut
|
||||
Attachments = "logsTest.log" #On peut attacher n'importe quel fichier
|
||||
}
|
||||
|
||||
Send-PnPMail @EmailParams #On envoie
|
11
README.md
11
README.md
@@ -14,9 +14,10 @@ I added lots of comments and READMEs for all of them, the creation of a wiki und
|
||||
|
||||
## Categories
|
||||
|
||||
- [Active Directory](https://git.kawawete.xyz/kawa/ps-scripts/AD)
|
||||
- [Anti Bloatware](https://git.kawawete.xyz/kawa/ps-scripts/Anti-Bloat)
|
||||
- [Intune](https://git.kawawete.xyz/kawa/ps-scripts/Intune)
|
||||
- [Windows](https://git.kawawete.xyz/kawa/ps-scripts/Windows)
|
||||
- [Sharepoint](https://git.kawawete.xyz/kawa/ps-scripts/Sharepoint)
|
||||
- [Active Directory](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/AD)
|
||||
- [Anti Bloatware](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Anti-Bloat)
|
||||
- [Intune](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Intune)
|
||||
- [Windows](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Windows)
|
||||
- [Sharepoint](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Sharepoint)
|
||||
- [Misc](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Misc)
|
||||
|
||||
|
64
Sharepoint/SP-empty.ps1
Normal file
64
Sharepoint/SP-empty.ps1
Normal file
@@ -0,0 +1,64 @@
|
||||
#Config Parameters
|
||||
$SiteURL = Read-Host -Prompt "Entrez l'adresse du site Sharepoint"
|
||||
$VersionsToKeep = 5
|
||||
|
||||
Try {
|
||||
#Connect to PnP Online
|
||||
Connect-PnPOnline -Url $SiteURL -Interactive
|
||||
|
||||
#Get the Context
|
||||
$Ctx= Get-PnPContext
|
||||
|
||||
#Exclude certain libraries
|
||||
$ExcludedLists = @("Form Templates", "Preservation Hold Library","Site Assets", "Pages", "Site Pages", "Images",
|
||||
"Site Collection Documents", "Site Collection Images","Style Library")
|
||||
|
||||
#Get All document libraries
|
||||
$DocumentLibraries = Get-PnPList | Where-Object {$_.BaseType -eq "DocumentLibrary" -and $_.Title -notin $ExcludedLists -and $_.Hidden -eq $false}
|
||||
|
||||
#Iterate through each document library
|
||||
ForEach($Library in $DocumentLibraries)
|
||||
{
|
||||
Write-host "Processing Document Library:"$Library.Title -f Magenta
|
||||
|
||||
#Get All Items from the List - Exclude 'Folder' List Items
|
||||
$ListItems = Get-PnPListItem -List $Library -PageSize 2000 | Where {$_.FileSystemObjectType -eq "File"}
|
||||
|
||||
#Loop through each file
|
||||
ForEach ($Item in $ListItems)
|
||||
{
|
||||
#Get File Versions
|
||||
$File = $Item.File
|
||||
$Versions = $File.Versions
|
||||
$Ctx.Load($File)
|
||||
$Ctx.Load($Versions)
|
||||
$Ctx.ExecuteQuery()
|
||||
|
||||
Write-host -f Yellow "`tScanning File:"$File.Name
|
||||
$VersionsCount = $Versions.Count
|
||||
$VersionsToDelete = $VersionsCount - $VersionsToKeep
|
||||
If($VersionsToDelete -gt 0)
|
||||
{
|
||||
write-host -f Cyan "`t Total Number of Versions of the File:" $VersionsCount
|
||||
$VersionCounter= 0
|
||||
#Delete versions
|
||||
For($i=0; $i -lt $VersionsToDelete; $i++)
|
||||
{
|
||||
If($Versions[$VersionCounter].IsCurrentVersion)
|
||||
{
|
||||
$VersionCounter++
|
||||
Write-host -f Magenta "`t`t Retaining Current Major Version:"$Versions[$VersionCounter].VersionLabel
|
||||
Continue
|
||||
}
|
||||
Write-host -f Cyan "`t Deleting Version:" $Versions[$VersionCounter].VersionLabel
|
||||
$Versions[$VersionCounter].DeleteObject()
|
||||
}
|
||||
$Ctx.ExecuteQuery()
|
||||
Write-Host -f Green "`t Version History is cleaned for the File:"$File.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Catch {
|
||||
write-host -f Red "Error Cleaning up Version History!" $_.Exception.Message
|
||||
}
|
BIN
Sharepoint/gui/spmover/Events.ps1
Normal file
BIN
Sharepoint/gui/spmover/Events.ps1
Normal file
Binary file not shown.
BIN
Sharepoint/gui/spmover/Functions.ps1
Normal file
BIN
Sharepoint/gui/spmover/Functions.ps1
Normal file
Binary file not shown.
14
Sharepoint/gui/spmover/exceptions.txt
Normal file
14
Sharepoint/gui/spmover/exceptions.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
20240307 08:51:28: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:27:01: New-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:33:71 Line | 33 | … ) {$newControl = New-Object System.Windows.Forms.$($Xml.ToString())} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot find type [System.Windows.Forms.Image]: verify that the assembly containing this type is loaded.
|
||||
20240307 09:28:50: New-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:33:71 Line | 33 | … ) {$newControl = New-Object System.Windows.Forms.$($Xml.ToString())} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot find type [System.Windows.Forms.Image]: verify that the assembly containing this type is loaded.
|
||||
20240307 09:34:41: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:34:53: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:38:58: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:40:53: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:41:31: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Image" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:44:00: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:44:41: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:45:56: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:47:04: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"."
|
||||
20240307 09:48:25: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'lbl_byWho' Key being added: 'lbl_byWho'"
|
||||
20240307 11:16:28: InvalidOperation: Line | 45 | $Script:refs['btn_Start'].Add_Click($eventSB['btn_Start'].Cli … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot index into a null array.
|
BIN
Sharepoint/gui/spmover/logo.png
Normal file
BIN
Sharepoint/gui/spmover/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
186
Sharepoint/gui/spmover/spmover1.ps1
Normal file
186
Sharepoint/gui/spmover/spmover1.ps1
Normal file
@@ -0,0 +1,186 @@
|
||||
################################################################################
|
||||
#
|
||||
# Name : SharePoint Mover
|
||||
# Version : 0.1
|
||||
# Author :
|
||||
# Date : 07/03/2024
|
||||
#
|
||||
# Generated with ConvertForm module version 2.0.0
|
||||
# PowerShell version 7.4.1
|
||||
#
|
||||
# Invocation Line : Convert-Form -Path $Source -Destination $Destination -Encoding ascii -force
|
||||
# Source : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.Designer.cs
|
||||
################################################################################
|
||||
|
||||
function Get-ScriptDirectory
|
||||
{ #Return the directory name of this script
|
||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
||||
Split-Path $Invocation.MyCommand.Path
|
||||
}
|
||||
|
||||
$ScriptPath = Get-ScriptDirectory
|
||||
|
||||
# Chargement des assemblies externes
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$FMain = New-Object System.Windows.Forms.Form
|
||||
|
||||
$components = New-Object System.ComponentModel.Container
|
||||
$menuStrip1 = New-Object System.Windows.Forms.MenuStrip
|
||||
$Mconnexion = New-Object System.Windows.Forms.ToolStripMenuItem
|
||||
$MConnexionSharepoint = New-Object System.Windows.Forms.ToolStripMenuItem
|
||||
$Mquestion = New-Object System.Windows.Forms.ToolStripMenuItem
|
||||
$MQuestionApropos = New-Object System.Windows.Forms.ToolStripMenuItem
|
||||
$MQuestionWiki = New-Object System.Windows.Forms.ToolStripMenuItem
|
||||
$Bgo = New-Object System.Windows.Forms.Button
|
||||
$CBsourceSite = New-Object System.Windows.Forms.ComboBox
|
||||
$CBdestSite = New-Object System.Windows.Forms.ComboBox
|
||||
$progressBar1 = New-Object System.Windows.Forms.ProgressBar
|
||||
$sourceInfo = New-Object System.Windows.Forms.ToolTip($components)
|
||||
$label1 = New-Object System.Windows.Forms.Label
|
||||
$label2 = New-Object System.Windows.Forms.Label
|
||||
#
|
||||
# menuStrip1
|
||||
#
|
||||
$menuStrip1.Items.AddRange(@(
|
||||
$Mconnexion,
|
||||
$Mquestion))
|
||||
$menuStrip1.Location = New-Object System.Drawing.Point(0, 0)
|
||||
$menuStrip1.Name = "menuStrip1"
|
||||
$menuStrip1.Size = New-Object System.Drawing.Size(800, 24)
|
||||
$menuStrip1.TabIndex = 0
|
||||
$menuStrip1.Text = "menuStrip1"
|
||||
#
|
||||
# Mconnexion
|
||||
#
|
||||
$Mconnexion.DropDownItems.AddRange(@(
|
||||
$MConnexionSharepoint))
|
||||
$Mconnexion.Name = "Mconnexion"
|
||||
$Mconnexion.Size = New-Object System.Drawing.Size(77, 20)
|
||||
$Mconnexion.Text = "Connexion"
|
||||
#
|
||||
# MConnexionSharepoint
|
||||
#
|
||||
$MConnexionSharepoint.CheckOnClick = $true
|
||||
$MConnexionSharepoint.Name = "MConnexionSharepoint"
|
||||
$MConnexionSharepoint.Size = New-Object System.Drawing.Size(131, 22)
|
||||
$MConnexionSharepoint.Text = "Sharepoint"
|
||||
#
|
||||
# Mquestion
|
||||
#
|
||||
$Mquestion.DropDownItems.AddRange(@(
|
||||
$MQuestionApropos,
|
||||
$MQuestionWiki))
|
||||
$Mquestion.Name = "Mquestion"
|
||||
$Mquestion.Size = New-Object System.Drawing.Size(24, 20)
|
||||
$Mquestion.Text = "?"
|
||||
#
|
||||
# MQuestionApropos
|
||||
#
|
||||
$MQuestionApropos.Name = "MQuestionApropos"
|
||||
$MQuestionApropos.Size = New-Object System.Drawing.Size(131, 22)
|
||||
$MQuestionApropos.Text = "A propos..."
|
||||
#
|
||||
# MQuestionWiki
|
||||
#
|
||||
$MQuestionWiki.Name = "MQuestionWiki"
|
||||
$MQuestionWiki.Size = New-Object System.Drawing.Size(131, 22)
|
||||
$MQuestionWiki.Text = "Wiki"
|
||||
#
|
||||
# Bgo
|
||||
#
|
||||
$Bgo.ForeColor = [System.Drawing.Color]::White
|
||||
$Bgo.Location = New-Object System.Drawing.Point(688, 155)
|
||||
$Bgo.Name = "Bgo"
|
||||
$Bgo.Size = New-Object System.Drawing.Size(75, 23)
|
||||
$Bgo.TabIndex = 1
|
||||
$Bgo.Text = "GO"
|
||||
$Bgo.UseVisualStyleBackColor = $true
|
||||
#
|
||||
# CBsourceSite
|
||||
#
|
||||
$CBsourceSite.ForeColor = [System.Drawing.Color]::White
|
||||
$CBsourceSite.FormattingEnabled = $true
|
||||
$CBsourceSite.Location = New-Object System.Drawing.Point(27, 131)
|
||||
$CBsourceSite.Name = "CBsourceSite"
|
||||
$CBsourceSite.Size = New-Object System.Drawing.Size(587, 21)
|
||||
$CBsourceSite.TabIndex = 2
|
||||
#
|
||||
# CBdestSite
|
||||
#
|
||||
$CBdestSite.ForeColor = [System.Drawing.Color]::White
|
||||
$CBdestSite.FormattingEnabled = $true
|
||||
$CBdestSite.Location = New-Object System.Drawing.Point(27, 182)
|
||||
$CBdestSite.Name = "CBdestSite"
|
||||
$CBdestSite.Size = New-Object System.Drawing.Size(587, 21)
|
||||
$CBdestSite.TabIndex = 3
|
||||
#
|
||||
# progressBar1
|
||||
#
|
||||
$progressBar1.Location = New-Object System.Drawing.Point(12, 345)
|
||||
$progressBar1.Name = "progressBar1"
|
||||
$progressBar1.Size = New-Object System.Drawing.Size(776, 23)
|
||||
$progressBar1.TabIndex = 4
|
||||
#
|
||||
# label1
|
||||
#
|
||||
$label1.AutoSize = $true
|
||||
$label1.Location = New-Object System.Drawing.Point(27, 112)
|
||||
$label1.Name = "label1"
|
||||
$label1.Size = New-Object System.Drawing.Size(62, 13)
|
||||
$label1.TabIndex = 5
|
||||
$label1.Text = "Site Source"
|
||||
#
|
||||
# label2
|
||||
#
|
||||
$label2.AutoSize = $true
|
||||
$label2.Location = New-Object System.Drawing.Point(27, 166)
|
||||
$label2.Name = "label2"
|
||||
$label2.Size = New-Object System.Drawing.Size(81, 13)
|
||||
$label2.TabIndex = 6
|
||||
$label2.Text = "Site Destination"
|
||||
#
|
||||
# FMain
|
||||
#
|
||||
$FMain.BackColor = [System.Drawing.SystemColors]::ControlText
|
||||
$FMain.ClientSize = New-Object System.Drawing.Size(800, 450)
|
||||
$FMain.Controls.Add($label2)
|
||||
$FMain.Controls.Add($label1)
|
||||
$FMain.Controls.Add($progressBar1)
|
||||
$FMain.Controls.Add($CBdestSite)
|
||||
$FMain.Controls.Add($CBsourceSite)
|
||||
$FMain.Controls.Add($Bgo)
|
||||
$FMain.Controls.Add($menuStrip1)
|
||||
$FMain.ForeColor = [System.Drawing.Color]::Snow
|
||||
$FMain.MainMenuStrip = $menuStrip1
|
||||
$FMain.Name = "FMain"
|
||||
$FMain.Text = "SharePoint Mover GUI"
|
||||
|
||||
$CBsourceSite.SelectedIndex = 0
|
||||
$CBtargetSite.SelectedIndex = 0
|
||||
|
||||
$MConnexionSharepoint.add_click({
|
||||
|
||||
|
||||
Connect-PnPOnline -Url $tenantURL -Interactive
|
||||
###############On recupere puis stocke la liste des sites dans les box
|
||||
$ComboboxList = (Get-SPOSite | Select Url).name
|
||||
$CBsourceSite.Items.AddRange($ComboboxList)
|
||||
|
||||
$ComboboxList = (Get-SPOSite | Select Url).name
|
||||
$CBtargetSite.Items.AddRange($ComboboxList)
|
||||
###############
|
||||
|
||||
})
|
||||
|
||||
$Bgo.add_click({
|
||||
|
||||
Move-PnPFile -SiteRelativeUrl $srcSite -TargetUrl $destSite -Force -AllowSchemaMismatch
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
$FMain.ShowDialog()
|
4
Sharepoint/readme.md
Normal file
4
Sharepoint/readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Scripts Sharepoint
|
||||
|
||||
- [Verifier la taille des corbeilles du Sharepoint](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Sharepoint/sharepoint-taille-trash.ps1)
|
||||
- [Nettoyer toutes les versions de fichier en conservant les 5 dernieres](https://git.azuze.fr/kawa/ps-scripts/src/branch/main/Sharepoint/SP-empty.ps1)
|
11
Sharepoint/sharepoint-taille-trash.ps1
Normal file
11
Sharepoint/sharepoint-taille-trash.ps1
Normal file
@@ -0,0 +1,11 @@
|
||||
#On rentre l'URL du site Sharepoint
|
||||
$SiteURL = Read-Host -Prompt "Entrez l'URL du site "
|
||||
|
||||
#On s'y connecte
|
||||
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
|
||||
|
||||
#On additionne la taille de tous les objets de la corbeille
|
||||
$RecycleBinSize = Get-PnPRecycleBinItem -RowLimit 500000 | Where-Object { $_.ItemState -eq "FirstStage" }| Measure-Object -Property Size -Sum
|
||||
|
||||
#On recupere la taille en format lisible
|
||||
Write-host "Recycle Bin Size (GB):" ([Math]::Round($RecycleBinSize.Sum/1GB,2))
|
29
Windows/FirefoxAutoUpdate.ps1
Normal file
29
Windows/FirefoxAutoUpdate.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
# On verifie quelle version est installée
|
||||
if (Test-Path "C:\Program Files\Mozilla Firefox\firefox.exe") {
|
||||
$installedVersion = (Get-ItemProperty "HKLM:\Software\Mozilla\Mozilla Firefox" -Name "CurrentVersion").CurrentVersion
|
||||
Write-Host "Version installee: $installedVersion"
|
||||
} else {
|
||||
Write-Host "Firefox n'est pas installe."
|
||||
}
|
||||
|
||||
# On récupère la dernière version
|
||||
$r = Invoke-WebRequest -Uri "https://www.mozilla.org/fr-FR/firefox/new/"
|
||||
$latestVersion = $r.Content.Split([Environment]::NewLine) | Select-String 'data-latest-firefox' |
|
||||
ForEach-Object { $_.ToString().Split('"')[9] }
|
||||
|
||||
# On fait le comparo entre la version installée et la dernière disponible
|
||||
if ($installedVersion -lt $latestVersion) {
|
||||
Write-Host "Nouvelle version disponible: $latestVersion"
|
||||
|
||||
# On DL la nouvelle version
|
||||
$url = "https://download.mozilla.org/?product=firefox-latest-ssl&os=win64&lang=fr-FR"
|
||||
$output = "C:\Users\$env:USERNAME\Downloads\FirefoxSetup.exe"
|
||||
Invoke-WebRequest -Uri $url -OutFile $output
|
||||
|
||||
# On installe silencieusement
|
||||
Start-Process -FilePath $output -ArgumentList "/S" -Wait
|
||||
|
||||
Write-Host "Firefox a bien ete passe en version $latestVersion."
|
||||
} else {
|
||||
Write-Host "Firefox est a jour. Version: $installedVersion"
|
||||
}
|
2
Windows/get-bio.ps1
Normal file
2
Windows/get-bio.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
#On recupere la liste des peripheriques biometriques
|
||||
Get-PnpDevice -PresentOnly -Class Biometric
|
25
Windows/getAcl.ps1
Normal file
25
Windows/getAcl.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
#On demande à l'user de rentrer le chemin source
|
||||
$entPath = Read-Host "Chemin vers le dossier a examiner : "
|
||||
|
||||
#et le chemin cible
|
||||
$outPath = Read-Host "Ou stocker le CSV : "
|
||||
|
||||
#On active la recursion
|
||||
$FolderPath = dir -Directory -Path "$entPath" -Recurse -Force
|
||||
|
||||
$Report = @()
|
||||
|
||||
#Une petite boucle pour recuperer les ACL de tous les dossiers
|
||||
Foreach ($Folder in $FolderPath) {
|
||||
$Acl = Get-Acl -Path $Folder.FullName
|
||||
foreach ($Access in $acl.Access)
|
||||
{
|
||||
$Properties = [ordered]@{'FolderName'=$Folder.FullName;'AD
|
||||
Group or
|
||||
User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited}
|
||||
$Report += New-Object -TypeName PSObject -Property $Properties
|
||||
}
|
||||
}
|
||||
|
||||
#On stocke le rapport la ou l'user veut
|
||||
$Report | Export-Csv -path "$outPath"
|
Reference in New Issue
Block a user