How can we Export windows accounts in bitvise 8.45 using powershell? - powershell-2.0

I'm using bitvise server 8.45 and manage more than 500 windows accounts, I would like to know if there is any way to export them to a .CSV file using powershell.
I know there is a way from bitvise itself, but that export literally exports everything which leads to a lot of cleaning work.

Related

Permission error for shutils moving png to path

You see I am making a python gui with pysimplegui for my old qrcode generator script so im using shutils for the user to download the file.
I am using the 'default' thing because i want it to save to my users path not mine, do you know some other way I can do that? because i think this is the reason its not working
I tried making it so the user inputs there username such as 'My laptop' so it adds it to the path
src_path = r"D:\Python\QRcode generator\output.png"
dst_path = r"C:\Users\Default\Pictures"
shutil.move(src_path, dst_path)
The code is correct. It wont give any error if you dont use C drive (Where the operating system is installed)
This is mostly due to C drive is protected for windows stability.
If you are using any code editor (Pycharm, VS Code etc.) or running the code in windows command prompt or any terminal etc. Try and run it with administrator rights
It should work.

Mapped drive letters immediately available?

I am using this to map a drive letter in PowerShell v2, and it works in that the drive letter shows up and is usable in Explorer.
$Network = New-Object -ComObject "Wscript.Network"
$Network.MapNetworkDrive($drive.name, $drive.value, $true)
However, if I then try to use that drive letter to do anything in Powershell, say to create a folder, I get a DriveNotFoundException. But as I said, the drive is there and usable manually. I thought I might need to wait for a bit, or refresh Explorer, or both, but doing so seems not to affect anything. However, if I turn around and rerun the script, which checks in advance to see if the drive is there, and only creates it if not, it will see the drive and not recreate, and a following task will work fine. As if perhaps the drive letter is session based?
I also tried adding
New-PSDrive -name:($drive.name -replace ':', '') -psProvider:FileSystem -root:$drive.value -scope:Global
as well, in the hopes that this would provide a session based drive, but no good.
An additional wrinkle is that the script has to be Run as Administrator, but again, if I do it as two different scripts, one to create the drive and one to use it, it works when both are Run As Administrator. It's only when both tasks are done in the one script that it fails.
One last point, I know PS 3 has a better way to handle mapped drives, but due to things beyond my control I am limited to PS v2.
I don't think what you want is possible in PowerShell v2. To have New-PSDrive create a Windows drive you need to add the parameter -Persist, which isn't available in PowerShell v2.
From the documentation:
-Persist
Creates a Windows mapped network drive. Mapped network drives are saved in Windows on the local computer. They are persistent, not session-specific, and can be viewed and managed in File Explorer and other tools.
I'd say your best option (aside from upgrading to PowerShell v3 or newer) is to use the net command:
& net use $drive.name $drive.value /persistent:yes

Can Rails pass a shell command to the local machine?

I am trying to get rails to select document attachments, then kick off the email client with the documents attached.
I have it working on my development laptop. If I build a string with the appropriate parameters and pass that to system() then it kicks off the email client with the attachments..
The string looks something like
#email_content = "C:\Program Files (x86)\IBM\Lotus\Notes\notes.exe"
"Mailto:?Attach=C:\Users\cm\RubymineProjects\technical_library\public\images\1\8302_printed.pdf
The first part calls the notes exe and the second part starts and email with the attachments. That worked fine on my laptop.
However, when I moved it to the server, it isn't kicking off the email client. I believe that it is because the shell commands are trying to execute on the server, not on the client.
Is it possible to run a shell command on the client machine? I am trying to get this working with Windows first and then the Mac environmemnt. I tried changing the C:\ to the machine name. i.e. \chrislaptop\Program Files (x86)\IBM\Lotus\Notes\notes.exe. but that didn't work.
No, fortunately that is not possible.
Imagine what happens when a request to some random page on the internet could trigger shell scripts on your local computer...
Arbitrary code execution escaping the browser is too invasive-- your app should not have access to the client's machine.
However, some applications may support URIs that open specific applications outside the browser. You generally see this more on mobile devices, but Spotify for example supports links that look like: spotify:artist:5lsC3H1vh9YSRQckyGv0Up which asks the user whether it is ok to open the Spotify application.
https://news.spotify.com/us/2008/01/14/linking-to-spotify/

Change the Values of the app config file in a windows service through another program

I have a windows service which downloads some files from SFTP and uploads it to database and generates PDf's from that data. So now when i should give the executable files to my client i think he need to change the app config file like sftp details and the pdf paths. So i am just thinking about a program like a windows forms or a console which reads the input and save those in app config file. Is it possible like and by the way i have created a setup project for the windows service where he gets 2 files .msi file and setup file. Is it possible to achieve the above problem in this case ?
If I understand correctly, you're wanting some kind of UI application that allows the user to configure the operation of the Windows service. This is certainly possible as I've been doing it for several years now. However, you don't want to do this via the app.config file. The app.config file is read by the Windows service when it starts up, so any changes made to it would go unnoticed until the service restarts. A better course of action would be to communicate the changes to the service via the Windows Communication Foundation (or some other ICP mechanism, e.g., pipes, sockets, shared memory, etc.). I've managed to use this successfully, although to be honest, I'm using ordinary sockets now. In any case, the service would basically "listen" for incoming configuration messages, "read" those messages, and then "configure" itself accordingly, perhaps even saving the changes in its app.config file so the changes are preserved for when the service restarts later.
HTH

Import a folder with files inside into a jailbroken iPhone using vb.net

I am writing an app in VB.NET (Visual Studio 2013) and as a final step, it has two copy a folder (with several files inside) into a certain directory in an iPhone.
The iPhone is jailbroken so it is possible to access every kind of directory and it should also be connected to the PC via USB. Is this even possible?
Thank you in advance!
I suck at visual basic, but I can tell you how you would do this programmatically:
First, you need to tunnel SSH over USB. You can do that by programatically executing itunnel_mux.exe from this zip.(you'll have to extract everything first.) Use it like this:
itunnel_mux.exe --tunnel -iport 22 -lport 2222
Then, you can use SCP (I'd recommend this library) to Copy files over from root#127.0.0.1:2222 (password alpine).
This is some example pseudocode (keep in mind, I don't know VB):
'Extract the exe and dll file from that zip
extract_files()
'I'm making a new variable containing the port number.
Dim port As string = "2222"
'I made up this function. Lets pretend it executes Batch code in the current directory (like a bat file)
execbat("itunnel_mux.exe --tunnel -iport 22 -lport " + port)
Using scp As New Rebex.Net.Scp
' connect to a server
scp.Connect(hostname)
' authenticate (change alpine if you changed your root passwd)
scp.Login("root", "alpine")
' Here, you can use "scp" to upload and download files
scp.PutFile("C:\Users\KevinKZ\Desktop\fileToUpload.jpg", "/var/mobile/Documents/fileToUpload.jpg")
scp.GetFile("/var/mobile/Library/SMS/sms.db", "C:\Users\KevinKZ\Desktop\SMS_Backups\2-1-14.db")
scp.Disconnect()
End Using
This solution is far from elegant. It also requires OpenSSH (I think). If you want something easier and/or more flexible, let me know. You might be better off using libimobiledevice. If you still need help let me know. You can email me at alex#alexhulbert.com
If the directory is accessible from Windows then yes.

Resources