Author Archives: mvalk
See backup chain SQL Server
See the backup chain in SQL Server SELECT TOP 100 s.database_name, CASE s.type WHEN ‘D’ THEN ‘Full’ WHEN ‘I’ THEN ‘Differential’ WHEN ‘L’ THEN ‘Transaction Log’ END AS BackupType, CAST(DATEDIFF(second, s.backup_start_date, s.backup_finish_date) AS VARCHAR(4)) + ‘ ‘ + ‘Seconds’ TimeTaken, s.backup_start_date, CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn, CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn, m.physical_device_name, CAST(CAST(s.backup_size / 1000000 [...]
Running PowerShell Script from Netlogon Share
To run a powershell script from a netlogon share, proceed as follows: create a batch file on the Netlogon Share call your PowerShell Script:powershell -executionpolicy bypass -file \\%userdomain%\netlogon\PS_login.ps1
PowerShell: updating AD photo for use in Office 365
I wanted to add a photo to every user in our Office 365 environment, so it is visible within our Lync software. Normally I would think I would go to Lync, open op “Tools” and then “Options”, select My Picture and change it. But in Lync 2013 the “Edit or Remove Picture” is grayed out. [...]
PowerShell: Import Scheduled Task
Some powershell I needed to import some scheduled tasks (xml files). Just for my own reference $XMLTaskDir = “C:\Program Files (x86)\****\***\” $Tasks = Get-ChildItem -Path $XMLTaskDir -Filter *.xml -Recurse foreach ($task in $tasks) { $TaskName = [io.path]::GetFileNameWithoutExtension($task) Register-ScheduledTask -Xml (get-content $task.FullName | out-string) -TaskName $TaskName –User <UserName> –Password <Password> -taskpath Imported Disable-ScheduledTask -TaskName $TaskName -TaskPath [...]
Server 2012 – installing Feature on Demand: .NET Framework 3.5
When installing SQL 2012 on my windows server 2012 box, I received errors about the install of .NET Framework 3.5.As .NET Framework 3.5 is a “feature on demand”, the binaries and other files associated with the feature are not included on the server. Windows Server tries to contact Windows Update to download the files it [...]
Changing an Office 365 User Principal Name with Powershell
It is very ease to change your login name in Office 365 if you have PowerShell for office 365 (x86 version, x64 Version) installed. First connect to Office 365 Connect-msolService Enter your Credentials, and then issue the next command: Set-MsolUserPrincipalName -NewUserPrincipalName [New Name] -UserPrincipalName [Old Name]
Amazon Powershell Tools
The amazon Powershell Tools have arrived: http://aws.amazon.com/powershell/578 commands When first starting your AWS Powershell Tools, you have to specify your Access Key and you Secret Access Key. They are then stored for future sessions.You can also create another set of stored Credentials. Set-AWSCredentials –AccessKey <Your Access Key> –Secretkey <Your Secret Key> –StoreAs SET1 SET1 is [...]
Link: Where is the PowerShell ISE in Windows 8?
http://www.trekker.net/archives/where-is-the-powershell-ise-in-windows-8/
PowerShell: Counting Files older than today (little mistake)
Today I had to count the number of XML files inside a folder. Simple, I thought. I created the following script: $OldestFileImport = get-childitem d: *.XML | where-object {$_.LastWriteTime -le [datetime]::today} $OldestFileImport.count After executing it gave me an empty return (??). I was sure there was one older xml file in D:… So to test [...]
PowerShell: Moving files into subfolder based on date
A script to move files from one directory to another and ordering them in subdirectory in the destination folder. The subdirectory name is bases on the date of the file, thus ordering all files with the same date in the same subdirectory. In the example below, only the XML files will be moved $SourceDir = [...]
Login