I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example).
I'm familiar with command line "scripting" wrappers like AxScript so that gets ...
Ok something so simple is just not working for me. I got a cmdlet that accepts a single parameter. I am trying to call a cmdlet within a Windows batch file. The batch file contains:
cd %SystemRoot%\system32\WindowsPowerShell\v1.0
powershell Set-ExecutionPolicy Unrestricted
powershell 'C:\convert-utf8-to-utf16.ps1 C:\test.txt'
powersh...
I use bash, and have done so for over a decade - but occasionally I wonder whether there has been any significant new developments in the world of Linux shells.
A few years back Microsoft released PowerShell, which seemed very interesting. Is there any comparable innovation going on in Linux shells?
...
I am trying to create a powershell script to automate user creation which is working great using ADSI. However I need to set the following properties and I am not sure how (or if ADSI can even do this):
Log on as a service
Allow logon locally
Any ideas how to do this?
...
I am trying to import users into AD using a CSV file, PowerShell, and Quest's AD CmdLets. When the users are added the UserPrincipleName is not added.
Here is a sample CSV:
FirstName,LastName,DisplayName,SamAccount,UserPrincipleName,Email
FirstA,LastA,"First Last",FLastAL.ou1,[email protected],[email protected]
Firs...
I'm attempting to make a batch file to upload a file to ftp server.
If I type it in manually it works fine but when i run the batch file it halts after it's connected... it says
connected to domain.com.
220 microsoft ftp server
User(domain.com:(none)):
then nothing else. What the heck is going on here?
Below is my batch file:
ftp ...
I am looking at dynamically building a bunch of Advanced Functions. I have been using New-PSScript for this but it doesn't allow for all the flexibility I am looking for.
I was reading the man page for about functions advanced parameters and saw something about Dynamic Parameters at the end of the help article which gives the following...
With MS ramming powershell into all new server products, I'm starting to (reluctantly) think I need to take it seriously. Part of "taking it seriously" is TDD. Have you found good methods to unit test power shell scripts?
I've found samples of mocking from Mr Geek Noise - but I'd really like something like RhinoMocks. Brian Hartsock ha...
Guys, could you help me please?
I'm trying to change programmatically SRS's settings of my audio device.
Well it's possible to use this command:
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,playback
but it still needs to push manually the "properties" button, go to the "SRS" tab and check the checkbox.
Is it possible to make p...
How can I view my reputation with a PowerShell function ?
...
I've been downloading a bunch of music the lately(yes yes, perfectly legal)
Anyway, the random idea to turn the folderstructure into and XML file occured to me.
I don't know what I'd do with it, but I'd like to be able to do it.
So I turned to Windows Powershell. Turning any data into and XML file is done via:
$P = "command to get dat...
Is there something better than using MSDOS in a bat file to run commmand line operations and copy files around.
I am running into the old chestnut "gotchas" with long file names etc - and for some reason the bat file wont pause - when I insert PAUSE in my script after running a command - it's just annoying.
Whats better out there?
Che...
Hi all!
I have a third-party application that's extensible by adding exe-files that perform dataconversion etc. I've written an extension in Powershell that does the conversion I want, but I'm unable to get the third-party app to run my ps1, as it will only accept an .exe file as an extension.
The app adds a filename as the first (and o...
Hi,
how can i add a custom function / object to the standard array of recognized functions in PowerShell so that i can call it from the shell of PowerShell?
Thanks
...
Hi,
I would like to be able to automate data entry to an Open Office spreadsheet using a PowerShell script, in the same way that Excel can be automated using PowerShell (see this Scripting Guy example). Is this possible?
Thanks, MagicAndi
...
This is a total newb question. Loving powershell, but I'm definitely not getting something here:
I'm creating a simple function to replicate a string x times. I am having some weird problem with the parameter -- it doesn't seem to be recognizing the second parameter.
When I run the function, it returns an empty string. Further, I thi...
How will I do this in powershell. I like to check which process/application is using the file, so that I can close it.
Thanks.
...
I am looking to create a script that emails and moves files recursively for all the files in a specified folder.
So for each file it will:
Email File1
move File1
Email File2
Move File2
Etc.
Now when I run the script below I get the following message:
The process cannot access the file because it is being used by another process.
$fi...
First off, either A) I'm not investigating into this hard enough or B) I've found a problem that requires some funky hack. By the way this is posh v1.0.
Here it goes:
A week or so ago I asked a question about redirecting the output from the exection of an EXE in powershell that was otherwise not being caught. I was swiftly presented wi...
I'm using the following to read one line from a whole load of text files and then summarize that information into one file.
$computers = Get-content computers.txt
$users = users.csv
$header = 'Computer','User','Date','Time'
Foreach ($computer in $computers)
{
$file = $computer +'.txt'
$a = import-csv $file -Header $header | Select -...