Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################
- #amiadmin?
- ###########################
- function get-adminstate
- {
- [CmdletBinding()]
- Param
- (
- )
- Begin
- {
- Write-Host
- Write-Verbose -Message 'Diese Funktion testet ihre Admin-Berechtigungen. Bitte einen Tick Geduld...'
- }
- Process
- {
- $groups = whoami /groups /fo csv | ConvertFrom-Csv | %{$_.SID -like 'S-1-5-32-544' -and $_.Attribute -like '*Aktiviert*'}
- if ($groups -like 'True'){
- Write-Host
- Write-Host -ForegroundColor Magenta -BackgroundColor Black 'ROOOOOOOOOOT!'
- Write-Host
- }
- else{
- Write-Host
- Write-Host -ForegroundColor Red -BackgroundColor Black 'no u unprivileged piece!'
- Write-Host
- }
- }
- End
- {
- Write-Verbose -Message 'Zufrieden? Bitte einen like für die SPE Paderborn dalassen! Außerdem ABO UND GLOCKE DRÜCKEN! Denkt auch an andere Social-Media Kanäle....'
- }
- }
- #####################################
- ##fakult
- #####################################
- ##kopierrecht bei le me
- ##141118
- function Get-fakult{
- #calc faculty
- #übernahme der eingegebenen zahl aus parameter
- ##args array shall not be used here
- ##Makes it recognized as CmdLet
- [CmdletBinding()]
- #Parameter Übernahme
- param (
- [Parameter(Mandatory=$true,
- ValueFromPipeline=$true,
- Position=0)]
- [ValidateRange(0,150)]
- [int] $max
- )
- Begin{
- ##spacing and dump of og value
- Write-Host -ForegroundColor Black 'HI. useless Program. Srsly.'
- ##declare as bigint!
- [bigint] $fak = 1
- }
- Process{
- Write-Verbose -Message ('Eingegebener Wert: '+ $max)
- # ##Lösungsvariante über schleife
- # for ($i = 1; $i -lt $max; $i++)
- # {
- # $fak = $fak * ($i+1)
- # }
- ##Lösungsvariante über Pipes
- 1..$max | %{$fak = $fak * $_}
- ##Error-Correcting IF 0!
- if ($fak -lt 1)
- {
- $fak = 1
- }
- ##Ausgabe
- Write-Verbose -Message ('Fakultierter Wert: ' +$fak)
- $fak
- }
- End{
- Write-Host -ForegroundColor Cyan 'Vielen Dank für die Nutzung dieses Stücks Abfall!'
- }
- }
- #######################################
- ###ADnewUser
- #######################################
- Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses "172.20.43.28","fd00:43::128"
- Remove-Computer -WorkgroupName "Freitag" -force
- Add-Computer -DomainName "contoso.com"
- ########################################
- $aids = Import-Csv -Path H:\Weltmeister\Weltmeister1974.csv -Encoding Default
- $pwd = Read-Host -AsSecureString 'PW PLS'
- $ou = Get-ADOrganizationalUnit -Filter { name -like '*43009*'}
- $aids | Where-Object -FilterScript { $_.Department -eq 'Trainer' } |
- New-ADUser -AccountPassword $pwd -Enabled $true -Path $ou -ChangePasswordAtLogon $true
- ##########################################
- $params = @{
- DisplayName="dna kruemel"
- GivenName="dna"
- Name="dna kruemel"
- Office="43"
- Path="OU=Abteilung 43009,OU=Paderborn,DC=contoso,DC=com"
- SamAccountName="dnakruemel"
- Surname="kruemel"
- Enabled = $true
- AccountPassword="123456"
- }
- New-ADUser @params
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement