To export all jobs from a SQL server.
Open ssms,connect to your sql server.Navigate to SQL Server Agent-- jobs.
Click View and select Object Explorer Details or press F7. The Object explorer details window should open on the right. Select all the jobs,right click select Script job as-Create to -- File. Select a location and give any file name and save.
All the jobs would be exported as a single file and you can run that on any other database to restore all the jobs.
Thursday, June 7, 2012
Saturday, April 21, 2012
Comparing two folders.
I recently was backing up my data and the backup device had lots of space so i turned up copying folders from multiple directories to the disc. But now was at loss when it came to deleting data from my hard drive. So wrote this little script. Thanks to Ying lin for showing the contains operator in powershell.
http://www.myitforum.com/articles/1/view.asp?id=10092
#usage = .\Compare-Items-in-two-directories.ps1 -path1 "e:\to write\dataondisk" -path2 "f:\dataoncd"
param([String] $path1,$path2)
$Diskdir = @()
$CDdir = @()
Get-childitem -Path$path1-recurse | %{$Diskdir=$Diskdir+$_.name}
$Diskdir.count Get-childitem -Path$path2-recurse | %{$CDdir=$CDdir+$_.name} $CDdir.count
$arraymatch= @()
$arraynotmatch= @()
foreach ($Itemin$Diskdir)
{
if($CDDir-contains$Item)
{
$arraymatch=$array+$item
}
else {
$arraynotmatch=$arraynotmatch+$item
}
}
$arraynotmatch
http://www.myitforum.com/articles/1/view.asp?id=10092
#usage = .\Compare-Items-in-two-directories.ps1 -path1 "e:\to write\dataondisk" -path2 "f:\dataoncd"
param([String] $path1,$path2)
$Diskdir = @()
$CDdir = @()
Get-childitem -Path$path1-recurse | %{$Diskdir=$Diskdir+$_.name}
$Diskdir.count Get-childitem -Path$path2-recurse | %{$CDdir=$CDdir+$_.name} $CDdir.count
$arraymatch= @()
$arraynotmatch= @()
foreach ($Itemin$Diskdir)
{
if($CDDir-contains$Item)
{
$arraymatch=$array+$item
}
else {
$arraynotmatch=$arraynotmatch+$item
}
}
$arraynotmatch
Thursday, March 1, 2012
How to open Event log of remote computer using powershell
$Log = Get-Eventlog -name application -computername remotecomputer
If the following error is thrown.
Get-EventLog : The network path was not found.
Check if the remote registry service is started on the remote computer
If the following error is thrown.
Get-EventLog : The network path was not found.
Check if the remote registry service is started on the remote computer
Subscribe to:
Posts (Atom)