I am planning to write an object-oriented shell (based on Python). I have many ideas already. But before I am going to implement it, I want to inspire me by some existing shell.
What I basically mean by object-oriented:
Parameters are not just an array of strings but an array of objects.
The return value is also an object.
There is no...
On my Windows box, I tried to create a Subversion patch by using the command svn diff > my_patch.diff. The resulting file was encoded with UTF-16, rather than UTF-8 or ASCII, so when I tried to use patch (from GnuWin32) to apply the patch, it didn't work.
I was able to convert the patch file to UTF8 by opening it in Notepad and saving ...
Is it possible to sort the output of the Format-List cmdlet by property name?
Suppose that I have an object $x with two properties "A" and "B", and when I run Format-List with it I get
(PS) > $x | Format-List
B : value b
A : value a
I would like to have
(PS) > $x | Format-List
A : value a
B : value b
NOTE: I should have specified ...
I am trying to mimic the action of right-clicking on a folder, setting "modify" on a folder, and having the permissions apply to the specific folder and subfolders and files.
I'm mostly there using Powershell, however the inheritance is only being set as "subfolders and files" instead of the whole "this folder, subfolders and files".
I...
I get this error with the following code:
System.Management.Automation.CommandNotFoundException: The term new-storagegroup....
RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
PSSnapInException snapInException = null;
PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerSh...
How can I get the return code from the following command:
RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
PSSnapInException snapInException = null;
PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException);
Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsCon...
Hi,
I have this simple script:
$files = dir .\configs | ? { !$_.PSIsContainer }
foreach($file in $files)
{
try
{
.\MyApp.exe -ErrorAction Stop $file
}
catch
{
write-host "!!!!!!!!!!!!error!!!!!!!!!!!!!!"
continue
}
}
The problem is that when
.\MyApp.exe -ErrorAction Stop $file
...
I have a function accepting an enum value as parameter. As an example, consider something like:
(PS) > function IsItFriday([System.DayOfWeek] $dayOfWeek) {
if($dayOfWeek -eq [System.DayOfWeek]::Friday) {
"yes"
} else {
"no"
}
}
Now, if I invoke it like this, everything is fine:
(PS) > $m = [System.DayOfW...
How can I get the return value of only the Name Variable?
RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
PSSnapInException snapInException = null;
PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException);
Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsCon...
Right now, I'm trying to use a Powershell script to read through a textfile and execute all of the Powershell scripts mentioned in it, but I can't get any results. I've tried specifying it this way:
Start-Job -ScriptBlock{powershell.exe -noexit $val} -name $jobnum
and this way: Start-Job -ScriptBlock{$val}
($val is the value of the li...
Scenary
SO Windows 7
I need to connect to remot host via cisco vpn. Sometimes the host destination network is the same of local network.
Example (Partial output of ipconfig command):
Ethernet adapter Cisco Vpn Adapter:
IPv4 Address. . . . . . . . . . . : 192.168.100.12
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Wireless...
I was playing around with PowerShell today and added a background color to all text ...now I want it gone!
Anyone know how to do that, as a side note I was trying to change the color of the whole blank area that fills the application (formerly known as the background ...good job Microsoft) so if you know how to do that please do share.
...
I have created a PowerShell script for copying files to a directory, the script, first creates a folder , or forces a new folder event if it exists. Then copies a directory from another location. After copying, the files I then need to copy the correct web config depending on a value given by the user execturing the script. The issue I a...
I am tring to parse the following file:
<?xml version="1.0" encoding="UTF-8" ?>
<printDrivers>
<printDriver id="XE8550">
<inf>x28550p.inf</inf>
<driverPath>\drivers\XEROX\8550\8550_Driver</driverPath>
<printerPaths>
<printerPath>\\print-man\man-25</printerPath>
</printerPaths>
</printDriver>
...
In experimenting with scriptblocks, I was attempting to use a scriptblock parameter with an advanced function and noticed that it performs differently than when supplied to a compiled cmdlet.
In reviewing this blog post from the PowerShell Team blog, it appears that the PowerShell engine should be evaluating the scriptblock if a scriptb...
Hi guys,
I have a web application that generates and uploads documents (word, pdf etc) on the server. Now I am writing a power shell script that will first transfer these files to an ftp folder. This part is done. The second script will run on my back up server every day and download all the folders/files from that ftp server to my back...
Hi,
I'm trying to work over PowerShell using the CERTENROLLLib and CERTCLIENTLib (COM objects).
$com = new-object -ComObject 'CERTCLIENTLib'
But i'm getting error: Cannot load COM type CERTCLIENTLib.
I think it is an issue with the namespace, but i don't have any idea what to do?
Can anybody help?
Thanks in advance!
...
I'm working on creating a script template to jump start the creation of new powershell scripts.
A quick list of some of the things I'm considering:
params block
usage function
main function
support for -verbose, -debug etc
Does anyone have something like this already, that they could share?
...
Is there any way to stop PowerShell from removing console message colors when using tee-object?
When I run without tee-object I get the nice error and verbose powershell message colors like this:
powershell.exe -noprofile -file $project_root/test_main.ps1
However, when I'm using tee-object (b/c I want logging to console & file), th...
I am using powershell 1.0 and I need to install a service on a remote machine and first uninstall it if it exists.
This is my script I have that installs the service, however, I seem unable to uninstall the
service. I have tried installutil however the service path is a network path which installutil, throws errors over.
I'm a complete...