Archive

Archive for the ‘Windows’ Category

Net Use and System error 53

October 15th, 2008 Mike 1 comment

I keep getting bit by this stupid problem, so I’ve decided to finally document the fix:

c:\> net use x: \\192.168.1.1\share\
System error 53 has occurred.
 
The network path was not found.

The problem is the trailing slash at the end of the UNC path.

c:\> net use x: \\192.168.1.1\share
The command completed successfully.
Categories: Windows Tags:

Set Passwords as Non-Expiring on the Windows Command Line

April 1st, 2008 Mike 1 comment

With the net user command, it’s possible to modify active directory user accounts on the command line.

net user myuser mypassword

Similarly, it’s possible to modify group membership with the net group command.

net group mygroup myuser /add

This is all well and good, but Microsoft in all its infinite stupidity did not include a way to set account passwords as non-expiring (and you might want to do this when creating active directory accounts with a script). That’s where the dsquery and dsmod commands come in. The following code will use dsquery to locate all the users with names like “myuser” and use dsmod to set the passwords as non-expiring.

for /f "delims=" %D in ('dsquery user -name myuser*') do dsmod user %D -pwdneverexpires yes

Ignore the part of Microsoft’s documentation that says the ds* commands ship in Windows 2008 Server. They also ship in Windows 2003 Server.

Categories: Windows Tags:

Windows 2008 Telnet (not SSH) Server

March 17th, 2008 Mike 2 comments

Have you heard that Windows 2008 will be able to run in a command-line only mode, but will continue to ship with a telnet server instead of SSH? This is awesome, seeing as how telnet is an insecure, antiquated method of remote access that should not be used by anyone under any circumstances. Congratulations Microsoft! Welcome to the 1970’s! Should we expect the SSH server in Windows Server 2033?

Seriously, what the fuck are those people doing over there?

Update According to Microsoft, there will be “a technology like this included in Windows Server 2008 called WinRS; or Windows Remote Shell. This command line tool allows administrators to remotely execute most cmd.exe commands using the WS_Management protocol.” Too bad it sucks!

See Also: “Not Invented Here Syndrome

Categories: Rants, Windows Tags:

Appending command output to a timestamped logfile (Linux vs Windows)

April 28th, 2006 Mike 1 comment

In Linux, it’s easy to log the output of a command to a timestamped log file:

echo this is easy >> $(date +%s).log

Here’s what I had to do to accomplish the same thing in Windows:

for /f "tokens=1,2,3,4 delims=/- " %%a in ("%date%") do set ts=%%d%%b%%c
echo this sucks >> %ts%.log
Categories: Linux, Rants, Windows Tags:

The project location is not trusted in .NET

March 23rd, 2006 Mike No comments

While doing some .NET development in C# (which is turning out to be a really fun language by the way) for a new project I’m working on, I came across this error:

The project location is not trusted.
 
Running the application may result in security exceptions when it
attempts to perform actions which require full trust.

This will happen when you have your Visual Studio project on a mapped drive. Here’s how you fix it:

C:\> caspol -q -machine -addgroup 1 -url file://U:/* FullTrust -name "U Drive"

Of course, caspol needs to be in your path in order to execute it, and since the .NET SDK installer doesn’t update the system path for some reason, you’ll probably have better luck running it with the full path:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasPol.exe
Categories: Windows Tags: