Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Reply To: [Solved] Different results when running script manually

Hah! You beat me to it! Solid. Many thanks again, sir!

View Article


Reply To: Using XML for variable source to modify registry values.

@Rob, Good god that made things significantly more simple. I had no clue how arrays worked and you using an example that fit what I was trying to do allowed me to "sort of" grasp the concept. I will...

View Article


Reply To: Script to send a lease in a database

Thank you for the reply , can you say me how to show the log in windows server please ? while the script working but ther is no record in database and i have any error message in the console … I gonna...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Using XML for variable source to modify registry values.

I'm glad it's making thing a little more simple for you. The big goal in Powershell is to understand how important generating a object to work with. Once you have the data you need in an object,...

View Article

Reply To: Script to send a lease in a database

I see that you've copied and pasted a lot of code from that blog post, but the problem is that the blog was demonstrating a SELECT command, which retrieves data from the DB. You've changed the SQL...

View Article


Executing SQL Query Remotely

I am looking for a way to use powershell to direct a remote MS-SQL server to execute a T-SQL Query I know I can open a new ps session using Enter_ps_session -computername (remove the second...

View Article

Reply To: Executing SQL Query Remotely

If the server has the SQL PowerShell module, I think the command is Invoke-SQL. If not, you'll have to code something in .NET. But you don't need Remoting. You can use .NET to tell the server to run...

View Article

Reply To: Script to install .EXE and configure on remote machines

Can someone confirm that when you use invoke-command to execute a command on a remote machine it does so under the credentials of the login that executed the command ?

View Article


Reply To: Executing SQL Query Remotely

so a command as simple as this invoke-SQL -serverinstance SQLServer\defaultinstance -user SA -Password -query \\SQLserver\Queries\query1.sql can the query argument be used to specifiy a query saved as...

View Article


Reply To: Executing SQL Query Remotely

I don't have it in front of me so I'm not sure if direct file input is possible, but Get-Content can obviously read a file. Lots if ways to read a file. For that matter if the file is on the server...

View Article

Reply To: Executing SQL Query Remotely

http://msdn.microsoft.com/en-us/library/cc281720.aspx has some lovely examples, BTW. And yes, you can specify an -InputFile for the query.

View Article

Reply To: Executing SQL Query Remotely

Here's a sample script that truncates log files of all user DB's using Invoke-SQLCMD: (Invoke-SQLCMD -Query "SELECT * FROM sysdatabases WHERE dbid > 4") | ForEach-Object { $SQLLogString = "N'" +...

View Article

Reply To: Encode Base64

I am a newbie to powershell, so sorry for the mistakes …. I have read this post and I wanted to apply the proposed solution by Dave Wyatt for this script: $ args = @ ' powershell.exe-Command { ECHO Y...

View Article


Image may be NSFW.
Clik here to view.

Most Efficient Way to Present System Uptime?

Hey everyone, Who remembers systeminfo? I liked to use systeminfo | more on my Windows XP and Win 7 systems to get the boot datetime, but Microsoft appears to have stripped the property in Windows 8...

View Article

Reply To: Most Efficient Way to Present System Uptime?

If you mean *aggregate* uptime, probably nothing easy. If you mean *current uptime since last reboot,* it's query Win32_OperatingSystem using CIM, get the last boot time, and calculate (it's simple...

View Article


Reply To: Managing Hostnames vs. GUIDs on a Pull Server

Could you not add some extra node checking within the MOF or script? Something that does infact look at hostname or AD guid and decide assign IP from there? Personally I hate this whole GUID/ one MOF...

View Article

Reply To: Executing SQL Query Remotely

in addition to Sam's solution I would suggest using PowerShell here strings with invoke-sqlcmd. If and when you run long and complex T-SQL it will be easier to use as opposed to writing a long one...

View Article


Reply To: Sharepoint 2010 Remote Admin

Thanks for the input. I've confirmed that I'm getting logged in with Kerberos credentials and that the SharePoint server is authorized for delegation. It seems the PowerShell part is right. I'll look...

View Article

Reply To: List Recipients w/o Exchange Unified Messaging Address

Ah. I gotcha – I'm not a big Exchange person, so I didn't realize that. So you're not actually needing to check the contents of the property so much as check to see if it exists. So looking at your...

View Article

Turncated Issue on outfile

Please understand that I am in the process of learning Powershel. Thank you $comments = @' Purpose: How Export Users Contacts for Email Migration '@ #——————————————————–...

View Article
Browsing all 13067 articles
Browse latest View live