Jump to content

Search the Community

Showing results for tags 'powershell'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • autoexec.gr
  • Events
  • Γενικά

Forums

  • Γενικά
    • Τα πρωτοσέλιδα
    • Café
    • Λοιπά Θέματα
    • Ειδήσεις & Εκδηλώσεις
  • Προϊόντα
    • Εργαλεία και συμβουλές
    • Microsoft Office
    • Windows
    • Windows Server
    • Microsoft SQL Server
    • Exchange Server
    • SharePoint Server
    • Microsoft Hyper-V
    • Microsoft Azure
    • PowerShell
  • Τεχνολογία
    • Cloud
    • Virtualization
    • Management & Automation
  • Εκπαίδευση & Πιστοποίηση
    • Εκπαίδευση
    • Πιστοποίηση
  • Αγγελίες
    • Προσφορά Εργασίας
    • Αγοραπωλησίες
  • Archives
    • Γενικά
    • Εργαλεία και συμβουλές
    • Hardware
    • OS
    • Servers
    • Netwok & Security
    • Magazino

Blogs

  • Το προσωπικό σου blog
  • Bits & Bytes
  • Το Ελληνικό Exchange Blog
  • Ioannis Alexopoulos -- IT Blog
  • Εξομολογήσεις ενός διαχειριστή
  • Για την αντι-γραφή
  • spanougakis.com
  • Project Management: Art or Science? Profession or Competence?
  • BlackTrack
  • Hyper-Vangelis
  • Frees Point
  • Klag Rulez
  • Heimaros
  • Info Overflow
  • The dark side
  • Greek Active Directory Blog
  • The Greek Windows PKI blog
  • Greek Geek Girls "3G"
  • Tips, Tricks and Recipes for IT Pros
  • There is nothing like 127.0.0.1
  • kpsalida's Blog
  • απλά...το βλογ μου
  • Θέλω να γίνω τσομπάνης!
  • Holy IT
  • Admin
  • Catastrophic Failure
  • Rocking with Knowledge of SQL Server
  • Apple Macintosh in the Enteprise
  • Firewall In A Nutshell
  • The Infrastructurer
  • Smart Office
  • Το άδειο σεντούκι
  • iThalis
  • Παιδιά! Έχουμε mail ?
  • SBS & όχι μόνο , Ioannis Zontos
  • Paradigm Shift
  • Αη-Τι (ο άγιος Τι)
  • The TroubleShooter
  • George Markou's Blog
  • fmarkos' Blog
  • dead:beef::1
  • Vaggelis' Blog
  • Apostolidis Cloud Corner
  • Who Is General Dentist?
  • Self-loading Mixers In Different Cities In Indonesia

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Occupation

Found 4 results

  1. Αυτό είναι ένα μικρό script το οποίο έγραψα με τη συμβολή του Γιώργου Βαράκη (aka the Veteran IT!) το οποίο κάνει μια απλή αλλά πολύ σημαντική λειτουργία που δεν μπορεί να γίνει με κάποιο τρόπο από το GUI. "Βγάζει" τα τελευταία recovery points του Microsoft System Center Data Protection Manager σε ένα εξωτερικό δίσκο για αποθήκευση κάπου εκτός του Datacenter. Και είναι πολύ σημαντικό ,καθώς ο DPM Server μπορεί να έχει μια δεύτερη εγκατάσταση σε ένα άλλο datacenter και μέσω της διαδικασίας chaining να μπορούμε να έχουμε και τα Backup της εταιρείας μας στο Continuity Plan , κάποιες φορές χρειαζόμαστε απλά να πάρουμε τα backups και να τα στείλουμε κάπου έξω από το κτίριο πολύ εύκολα (φυσικά κρυπτογραφώντας τα με Bitlocker!) . <#This script will export the latest recovery point of each datasource in a Microsoft System Center 2012 R2 DPM installation to a disk. This disk can be an external disk for offsite storage. In order for DPM to run the recovery procedure a DPM agent must be installed on the server hosting the external disk. Below there is a Variable section in which you should specify the DPM server name , the target server name as well as the disk drive letter. I have also added a small part in which you can remove previous versions of the backup as a a small retention policy. You can also specify which protection groups you want exported , or the script will select all of them. I have not added a Sharepoint recovery because it is a bit more complicated than simply extracting the data. AX Enjoy! #> #Start by importing the System Center 2012 R2 Module import-Module "C:\Program Files\Microsoft System Center 2012 R2\DPM\DPM\bin\dpmcliinitscript.ps1" #------------------------------------------------------------------------------------------------------# #Arm the variables #Who's the DPM Server $DPMServerName = "DPMServer" #Who's the target server? (The server that has an agent installed and the usb hdd) $DestinationServerName = "TargetServer" #What's the disk location for the exports? (What is the drive letter on the usb drive?) $DestinationLocation = "X:\DPM\" #Create a datetime format for the folders $Date = (get-date -DisplayHint date -Format yyyy-MM-dd).ToString() #Protection groups for which we want the exports, if you do not specify it ,all protection groups will be selected , an example would be @("PG_ONE","PG_TWO","SQL") etc $ProtectionGroupName=@() #Get the older backups to compare and delete $files=get-childitem "\\TargetServer\e$\DPM" #Set the retention period , recovery points (and files!any file! be warned!) older than the days specified will be deleted on the target hdd. $Days="-2" #------------------------------------------------------------------------------------------------------# #Start by removing previous backups #Set the exclusion date in minutes,hours or days $Today=(Get-Date).AddDays($Days) #Start comparing files Foreach ($File in $Files) { #If you find a file that is older than the expected date if ($file.Creationtime -lt $Today) #Delete the sucker {remove-item $file.FullName} } #OK, let's see what we got #Create an array and connect to the DPM Server $ProtectionGroups=@() Connect-DPMServer $DPMServerName #Get protection groups,if specified ,otherwise get all of the protection groups If($ProtectionGroupName.Count -ne 0) { foreach($Name in $ProtectionGroupName) { $ProtectionGroups+=Get-DPMProtectionGroup -DPMServerName $DPMServerName |? {$_.Name -eq $Name} } } Else { $ProtectionGroups=Get-DPMProtectionGroup -DPMServerName $DPMServerName } #If you found something , proceed ,else inform the user that nothing was found on the end of this script If($ProtectionGroups.Count -ne 0) { #Let's see what's inside the Protection Groups foreach ($ProtectionGroup in $ProtectionGroups) { #Get the Datasource information , because each protection group might have different protected sources $Datasources= Get-datasource -ProtectionGroup $ProtectionGroup #Start the processing foreach($Datasource in $Datasources) { #Get the last recovery point for the selected datasource,we only need that to restore $LastRecoveryPoint = Get-DPMRecoveryPoint -DataSource $Datasource | sort -Property RepresentedPointInTime -Descending | select -first 1 #Start filtering the datasource so that we get the correct type to proceed with recovery, as each type has a different cmdlet set #If you find a hyperv datasource If($Datasource.ObjectType -match "Hyper-V") { #Construct the foder path using the variables, since all of the VM protected workloads use an Offile\ or Online\ we only need the LastRecoveryPoint.Name $DestinationLocationFinal=$DestinationLocation+$Datasource.ProductionServerName+"\"+ $LastRecoveryPoint.Name+" "+ $Date #Specify recovery options for the selected Type $RecoveryOption = New-DPMRecoveryOption -HyperVDataSource -TargetServer $DestinationServerName -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation $DestinationLocationFinal #Recover the sucker Recover-RecoverableItem -RecoverableItem $LastRecoveryPoint -RecoveryOption $recoveryOption } If($Datasource.ObjectType -match "Volume") { #Construct the foder path using the variables, this is a bit more complicated as volume based datasources use a Drive:\ scheme, we need to trim out the ":\" part to construct a working NTFS path $DatasourceName=$LastRecoveryPoint.name.Trim(":\") $DestinationLocationFinal=$DestinationLocation+$Datasource.ProductionServerName+"\"+ $DatasourceName+" "+ $Date #Specify recovery options for the selected Type $RecoveryOption = New-DPMRecoveryOption -FileSystem -TargetServer $DestinationServerName -RecoveryLocation CopyToFolder -AlternateLocation $DestinationLocationFinal -RestoreSecurity -OverwriteType NoOverwrite -RecoveryType Restore #Recover the sucker Recover-RecoverableItem -RecoverableItem $LastRecoveryPoint -RecoveryOption $recoveryOption } If($Datasource.ObjectType -match "Exchange") { #Construct the foder path using the variables $DestinationLocationFinal=$DestinationLocation+$Datasource.ProductionServerName+"\"+ $LastRecoveryPoint.Name+" "+ $Date #ok , lets find the recoverable item $RecoverableItem=Get-DPMRecoverableItem -RecoverableItem $LastRecoveryPoint -BrowseType Child #Specify recovery options for the selected Type $RecoveryOption = New-DPMRecoveryOption -Exchange -TargetServer $DestinationServerName -TargetLocation $DestinationLocationFinal -ExchangeOperationType NoOperation -RecoveryLocation CopyToFolder -RecoveryType Restore #Recover the sucker Recover-RecoverableItem -RecoverableItem $RecoverableItem[0] -RecoveryOption $recoveryOption } If($Datasource.ObjectType -match "SQL") { #Construct the foder path using the variables $DestinationLocationFinal=$DestinationLocation+$Datasource.ProductionServerName+"\"+ $LastRecoveryPoint.Name+" "+ $Date #Specify recovery options for the selected Type $RecoveryOption = New-DPMRecoveryOption -SQL -TargetServer $DestinationServerName -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation $DestinationLocationFinal #Recover the sucker Recover-RecoverableItem -RecoverableItem $LastRecoveryPoint -RecoveryOption $recoveryOption } If($Datasource.ObjectType -match "System") { #Construct the foder path using the variables $DestinationLocationFinal=$DestinationLocation+$Datasource.ProductionServerName+"\"+ $LastRecoveryPoint.Name+" "+ $Date #Specify recovery options for the selected Type $RecoveryOption = New-DPMRecoveryOption -SystemProtectionDatasource -TargetServer $DestinationServerName -RecoveryLocation CopyToFolder -RecoveryType Restore -TargetLocation $DestinationLocationFinal #Recover the sucker Recover-RecoverableItem -RecoverableItem $LastRecoveryPoint -RecoveryOption $recoveryOption } } } } Else { #Inform the user that nothing was found! Write-Host "No Protection Groups found!" -ForegroundColor Yellow } <# $Editor= Panagiotis Pataridis Senior IT Consultant MCSE,MCSA,MCITP MVP on Enterprise Mobility (Remote Desktop Services) MS-vTSP on Desktop Experience $SubjectMatterExpert= George Varakis MCSE,MCSA,MCITP Enterprise Services Manager #>
  2. Και ένα μικρό Script για να ειδοποιούνται οι χρήστες πως οι κωδικοί τους θα λήξουν σε X μέρες <# Script to notify users of password change #> #Variables----------------------------------------------------------### #What date is it? $Today=Get-date #How many days before should we notify the user? $Days=50 #Specify a From address $From="[email protected]" #Specify a subject for the message! $Subject="Your account will expire soon! Action Required" #Specify the SMTP Server ! $SMTPServer="10.0.0.1" #-------------------------------------------------------------------### #Start!-------------------------------------------------------------### #Find all users that will need a password change within the specified days, We are searching for all Enabled accounts , with Password never expires option not set and not containing a $ sign (Domains with trust accounts,GMSA accounts ...etc, we do not need those) $Expiring=Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False -and Name -notlike "*$*"} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" ,"PasswordExpired" , "Mail","UserPrinciPalName" #Loop through each account foreach ($Account in $Expiring) { #And get its expiring date, convert it to a more readable format as msDS-UserPasswordExpiryTimeComputed is a calculated field and it is a mess $ExpiringDate=[datetime]::FromFileTime($Password."msDS-UserPasswordExpiryTimeComputed") #If you do find an account that has not expired and the remaining days are less than the days specified if ($Account.PasswordExpired -eq $false -and ($ExpiringDate - $Today).Days -lt $Days ) { #Start the notification process #Get the actual UPN in the domain as this may differ from the users email $AccountUPN=$Account.UserPrinciPalName #Calculate the days left $DaysLeft=($ExpiringDate-$Today).Days #Inform the user Send-MailMessage -SmtpServer $SMTPServer -From $From -To $Account.Mail -Subject $Subject -Body "Your AD Password for account $AccountUPN will expire in $DaysLeft days! Please change it." } }
  3. Κλαησπερα σε συνεχεια του παλιου θεματος που ειχα ανοιξει εδω http://autoexec.gr//index.php?/topic/1484-script-για-σβησιμο-shared-αρχειων/ θα ηθελα να μπορω , στο 2ο script, με το keeppaths, στους εσωτερικους φακελους που θα δηλωσω να παραμενουν και τα αρχεια που περιεχονται εκει. Μπορει να γινει ? αν ναι πως? ευχαριστω ​
  4. πως ξεπερνάμε αυτό το μύνημα σε domain με WS2008 SP2? "Unable to find a default server with Active Directory Web Services running." κατέβασα το patch από την microsoft για WS2008 & WS2003 και μου βγάζει μύνημα ότι "The update doe not apply to your system" το service ναι δεν υπάρχει... οπότε τι κάνω σε αυτή την περίπτωση; (μην με ρωτήσετε αν είμαι σίγουρος ότι έτρεξα το σωστό αρχείο στον server)
×
×
  • Create New...