Powershell $lastexitcode return works on non-zero return but keeps hanging...
So I have performed some major customization on SQLSPADE thats available on CodePlexsqlspade.codeplex.comHere is where I am stuck. I have 2 functions in play. When the first functions executes, It...
View ArticleHow to check to see if a file is open/locked before trying to copy it
I am trying to copy a set of files and folders fomr one location ot another. It works ok, but if a file is open it generates an error. Is there a way to check to see if a file is open before trying to...
View ArticleWhere does PowerShell look for DLLs? I have a custom DLL I want to load.
Re: Where does PowerShell look for DLLs? I have a custom DLL I want to load.I wrote a .Net DLL. Currently I am loading it in my PS script with a LoadFrom. I will be distributing my solution to several...
View ArticleNeed to use -credential in get-wmiobject
Hi,I would like to remotely enumerate printers on our 2012r2 print server from a Windows 7 box. I am logged into the Win7 box with a domain account that is in the local admins group on the print...
View ArticleRegister-PSSession Problem
Greetings everyone. I'm trying to assign non-admins access to webadministrationcommandlets. First I created a configuration file:New-PSSessionConfigurationFile –ModulesToImport WebAdministration...
View ArticlePS script to find recursive folders in a path created within a specific time...
Hi there,I'm fairly new to PS and was wondering if anyone could help out with a script to pass in a folder path, then within that path it will recursively check all folders created time, say within...
View ArticleNeed convert txt to csv using Powershell
Hello,I'm trying to read txt file:================================================== URL : about:blank Title : Visit Time : 06.10.2014 8:43:03 Visit Count : 5354...
View ArticleCreate (security)event
Hello,How can I use PowerShell to create a (security) event?The structure of the message part of the event should be like the following:<EventData><Data...
View ArticleUninstall-Windowsfeature in WS2012 R2
Hi,When I try to remove a feature using Uninstall-Windowsfeature with -Remove it doesn't seems to remove the binaries from the server as when I try to run Install-Windowsfeature for the same feature...
View ArticleInstall Powershell 3 via GPO?
Hi,I would like to be able to install PowerShell 3 on all of our Windows 2008 R2 SP1 servers.Is GPO the best way to go? (I know very little about GPO)I found this code:@echo off SET...
View ArticlePowershell $webclient.UploadFile
Hello Community!I am new to powershell and i have been playing around with getting files to upload using FTP.I have got it working and i am happy with the results but i would like to get the script to...
View ArticleCannot save xlsx file from powershell
Hi.My problem is that I cannot save xlsx file that is created by ps script. Last string drop errors: Microsoft Excel cannot get access to file: C:\Users\PROFILENAME\Desktop\67E69410 This file is...
View ArticleUsing powershell to check and removing duplicate entries
Hi Guys,I have been trying to get my head around powershell to check a csv file. It needs to read in each line in the csv and compare it to the last one and only pull out the entry with the newest time...
View ArticlePowerShell Copy
How do I copy files from one network drive to another network drive using Power Shell. The files are SQL transaction logs so I need the files for a 24 hour span. I would like the copy to run at the...
View ArticleTest Script using Get-WebSite
I need to be able to test a given web site and ensure that 5 different properties are set correctly.If all the properties are correct, the test script should return true, otherwise false. So far I have...
View ArticleActive code page
For some reason, write-host does not display correct Chinese anymore. I tried using chcp 936 but getting 'CHCP : Invalid code page'.
View ArticleGet-Childitem with Get-FileHash Info
Hello,I have been able run the following script to get File names in a Recurse folders, although I'm looking to use Get-Filehast too, although I'm not sure or unable to tag this on the end of this...
View ArticleAdd line to a text file just after a specific line with PowerShell
Hi, I have to edit remotely a file called nsclient.ini on hundreds of computers, the file contains some command definitions. For example:[/settings/external scripts/scripts] check_event="C:\Program...
View ArticleDon't Import Last Line In CSV
I'm using PowerShell and Log Parser 2.2 to import CSV data into SQL Server. I've encountered an issue whereby a batch of files has an extra line at the very end (totals) and I don't want it imported....
View ArticleSecurity permission in DNS object
Hi.I have problem with several DNS objects, in security permission disappeared account of himself.I can`t find powershell cmdlet for this action.I need 2 scripts: one for get all dns object without...
View Article