magritton
5/16/2016 - 9:32 PM

This script generates 100 random strings. The commented part enables all letters and numbers.

This script generates 100 random strings. The commented part enables all letters and numbers.

#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

    $webUrl = "http://spsvde001/Greater5KSite"
    $listName = "Greater5K"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    
    $i = 0
for($i -eq 0;$i -lt 6000;$i++){
    $Private:OFS = ""
    $PasswordLength = 5
    $InclChars = ‘abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789’
    $RandomChar = 1..$PasswordLength | ForEach-Object { Get-Random -Maximum $InclChars.length }
    $RandomPassowrdChar = [String]$InclChars[$RandomChar]
    
    
    $InclNums = "123456789"
    $RandomNums = 1..$PasswordLength | ForEach-Object { Get-Random -Maximum $InclNums.length }
    $RandomPassowrd = [String]$InclNums[$RandomNums]

    #$ItemTitle = $RandomPassowrd

    $newItem = $list.AddItem()
    $newItem["Title"] = $RandomPassowrdChar
    $newItem["NumberField"] = $RandomPassowrd
    $newItem.Update()
    write-host "****************************************"
    write-host "Item created"
}
#Dispose web
$web.Dispose()
#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

    $webUrl = "http://spsvde001/twf"
    $listName = "Test Number Conv"
    # Open web and library
    $web = Get-SPWeb $webUrl
    $list = $web.Lists[$listName]
    
    $i = 0
for($i -eq 0;$i -lt 100;$i++){
    $Private:OFS = ""
    $PasswordLength = 5
    ##$InclChars = ‘abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789’
    $InclChars = "123456789"
    $RandomNums = 1..$PasswordLength | ForEach-Object { Get-Random -Maximum $InclChars.length }
    $RandomPassowrd = [String]$InclChars[$RandomNums]

    $ItemTitle = $RandomPassowrd

    $newItem = $list.AddItem()
    $newItem["TestNum"] = $ItemTitle
    $newItem.Update()
    write-host "****************************************"
    write-host "Item created"
}
#Dispose web
$web.Dispose()
#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
 
# Script settings
$webUrl = "http://spsvde001/twf"
$listName = "Test Capitalization"

$ItemTitle = "EC DECLARATION OF CONFORMITY"

# Open web and library
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]

$newItem = $list.AddItem()
$newItem["Title"] = $ItemTitle
$newItem.Update()
write-host "****************************************"
write-host "Item created"
 
#Dispose web
$web.Dispose()