Powershell SMO work in cmd, not from script
This was originally posted (incorrectly) in the SMO/RDO/DMO forum. Sorry.My code (Server 2003 Enterprise, SQL Server 10.0.5512.0, Powershell v1.0 ISE) is as follows:function Script-Database_01 {#...
View ArticleWho am I ?
Hi,I run, now, my jobs with steps written in powershell.I would like to get informations about the current job, the current step, I am running.I read some topics about token (like $(ESCAPE_NONEJOBID)))...
View ArticleMove SQL Instance to Another Node from a Remote Server
I am writing a script using Get-WmiObject to inspect remote clusters and determine if SQL instances are running on their preferred nodes. This is working fine, but now I want the script to move...
View Articledelete files before 8PM
hello experts,i have some error in using "sp_delete_file" Stored procedure. so looking some other option or script to delete files before 8 PM. daily. if some one can design such script please help.
View ArticleSQL Logins output to a file via sp_help_revlogin
Hi all,I'm looking to get sql logins output to a file via powershell.After many different, but unsuccessful searches to find a PS script to retrieve SQL Logins via the stored proc sp_help_revlogin, I'm...
View ArticlePrinting to a specific printer
As of now I have this in my Execute Process task Command section to print a list of text files in a directory.Get-ChildItem -path $Directory -recurse -include *.txt | ForEach-Object {Start-Process...
View ArticlePowershell: Passing variables to scriptfile using invoke-sqlcmd
Hi,I have several large scripts that we have to usually modify manually to make changes to our databases. Usually this consists of 3 different variables. Lets use $city, $state, $country for example. I...
View ArticleHelp with PS Script
Need help from the PS gurus out there!I'm new to PS and I'm trying to create a script that dumps some basic server info to a CSV file. Now I can get it to work and gather most all my info I need and...
View ArticlePowershell script enhancement
Hi everyone.I have a script that works great at the moment. The Script I use checks all SQL servers in a table for the last backup status. It then emails out an exception report for databases missing a...
View ArticlePoweshell array confusion
HiI am new to powershell, and am struggling a bit with the passing of an array as a variable. Firstly, I have a function which will return a set of server names based on and variable for the...
View Articlepscustomobject help
Hi gang,I have an array, $Data, having a bunch of elements, $Datum, each of which contains something like this:@{Date =30-Nov-12; BillingWeek=1; BillingMonth=DECEMBER; Q=Q1; Weekday=Friday;...
View ArticleGood current Powershell/SQL tutorials?
Hi,Trying to follow older tutorials is pretty frustrating. It seems like a lot of the syntax results in errors, or in some cases is a few versions behind and there are probably better ways to do things...
View ArticleCan't get powershell script to run as Agent Job - runs from CMD
I thought I'd try Powershell for some file maintenance. Thought it might be fun! And now I'm stuck.Can anyone see what I'm doing wrong?I'm having trouble with Rename-Item. This line works from...
View Articlescript
I have this code which prints files inside the tempprint folder.TargetFolder = "C:\tempprint" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(TargetFolder) Set...
View ArticlePrinting from powershell
Get-ChildItem -path $Directory -recurse -include *.html | ForEach-Object {Start-Process -FilePath $_.fullname -Verb Print -PassThru | %{sleep 5;$_} | kill }How do I suppress the print dialog ? I need...
View ArticleCopy a file from each subdirectory to one folder
Hi,I'm trying to do something like this:[code="plain"]Get-ChildItem -Path "\\drive\s*\*.txt" | ForEach-Object {Copy-Item "\\drive\Erik" }[/code]But it isn't working, and I'm not really getting anywhere...
View ArticlePowershell Script help for Scripting
Hello , Please assists me if any one has idead about this . I have script in powershell which script out SP with specific condition . Want to achieve is drop those SP once the script generation is...
View ArticleAdd output of Powershell query Multiple WMI Classes to SQL
Hi All,I'm new to Powershell and I've been playing around with scripts all week but not having a scripting background I'm really not sure what I'm doing. I located the below script in another one of...
View ArticlePoweshell script to script out jobs, databases, users, linked servers,...
create a c:\servers.txt file with list of serversand copy the following into a file .ps1enjoyfunction getwmiinfo ($svr) { gwmi -query "select * from Win32_ComputerSystem" -computername $svr | select...
View Article